[Zope-Checkins] CVS: Zope/utilities - testrunner.py:1.23

Shane Hathaway shane@cvs.zope.org
Fri, 11 Jan 2002 12:08:03 -0500


Update of /cvs-repository/Zope/utilities
In directory cvs.zope.org:/tmp/cvs-serv27070/utilities

Modified Files:
	testrunner.py 
Log Message:
These changes make it so you can safely "import Zope" in a unit test.  You
still shouldn't import Zope in unit tests, but most of the existing CMF tests
depend on importing Zope and there was a hidden exception occurring anyway.
(OFS.Application.initialize() was failing.)


=== Zope/utilities/testrunner.py 1.22 => 1.23 ===
         os.environ['SOFTWARE_HOME'] = sw_home
 
+    try:
+        # Try to set up the testing environment (esp. INSTANCE_HOME,
+        # so we use the right custom_zodb.py.)
+        import Testing
+    except ImportError:
+        pass
+
     if test_all:
         testrunner.runAllTests()
     elif pathname: