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

Tres Seaver tseaver@zope.com
Wed, 17 Oct 2001 13:51:09 -0400


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

Modified Files:
      Tag: tseaver-utxfixup-branch
	testrunner.py 
Log Message:


  - Ensure that running testrunner from deeper in the tree works.


=== Zope/utilities/testrunner.py 1.15.20.3 => 1.15.20.4 ===
 
     if set_python_path:
-        testrunner.report( "Adding %s/lib/python to sys.path." % os.getcwd() )
-        sys.path.insert( 0, os.path.join( os.getcwd(), 'lib/python' ) )
+        script = sys.argv[0]
+        script_dir = os.path.split( os.path.abspath( script ) )[0]
+        zope_dir = os.path.abspath( os.path.join( script_dir, '..' ) )
+        sw_home = os.path.join( zope_dir, 'lib', 'python' )
+        if verbosity > 1:
+            testrunner.report( "Adding %s to sys.path." % sw_home )
+        sys.path.insert( 0, sw_home )
 
     if test_all:
         testrunner.runAllTests()