[Zope] How to access the content of a file in a test suite in a portable way

Marco Bizzarri marco.bizzarri at gmail.com
Wed Sep 17 22:16:53 EDT 2008


On Wed, Sep 17, 2008 at 12:58 PM, Peter Bengtsson <peter at fry-it.com> wrote:
> From within the product class you can do this:
>
> from Globals import package_home
> class MyProduct(...):
>    meta_type = '...'
>    def do_something(self):
>         print package_home(globals())
>
>


Thanks, Peter; but that does not work inside a test case run as:

python tests/testMyTestSuite.py


I'm using at the moment:


    def product_prefix(self):
        return sys.modules['Products.MyProduct'].__path__[0]


but I'm not sure if it is an horrible hack or now.

Regards
Marco

-- 
Marco Bizzarri
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.com/


More information about the Zope mailing list