Re: [Zope] How to access the content of a file in a test suite in a portable way
On Thu, Sep 18, 2008 at 4:16 AM, Marco Bizzarri [EMAIL PROTECTED] wrote: 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. What about yourmodule.__file__ ? -- Israel ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] How to access the content of a file in a test suite in a portable way
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()) 2008/9/17 Marco Bizzarri [EMAIL PROTECTED]: Hi all. I'm writing a number of acceptance tests where I need to compare whether the content of a text file is equals to another file. The comparision files are in a subdirectory of the acceptance test directory itself, therefore, once I know where my product is on the filesystem, I can access the test files from there. What is the accepted way to do know the directory of a product? Regards Marco -- Marco Bizzarri http://notenotturne.blogspot.com/ http://iliveinpisa.blogspot.com/ ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) -- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] How to access the content of a file in a test suite in a portable way
On Wed, Sep 17, 2008 at 12:58 PM, Peter Bengtsson [EMAIL PROTECTED] 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/ ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )