[Zope-Checkins] CVS: Zope2 - __init__.py:1.1.4.2

chrism@serenade.digicool.com chrism@serenade.digicool.com
Sat, 3 Mar 2001 15:34:57 -0500


Update of /cvs-repository/Zope2/lib/python/Testing
In directory serenade:/slab/home/chrism/sandboxes/CatalogBTreesIntegration/lib/python/Testing

Modified Files:
      Tag: Catalog-BTrees-Integration
	__init__.py 
Log Message:
__init__.py is now smart enough to set up the testing environment by walking the path from os.getcwd() down, until it can import ZODB.  After it can import ZODB, it sets up SOFTWARE_HOME and INSTANCE_HOME.  This makes it possible to use the idiom:

import sys
sys.path.insert(0, '.')
try:
    import Testing
except ImportError:
    sys.path[0]='../../..'
    import Testing

...from a unit test script in 'lib/python/Products/ZCatalog/tests' in order to get an environment in which "import Zope" or "import ZODB" or "import Products.ZCatalog" will work.  The unit test script can be run from either the directory it is located within, or it can be run from the lib/python dir.