[Zope-Checkins] SVN: Zope/trunk/test.py Now also scans instancehome
for stale bytecode.
Stefan H. Holek
stefan at epy.co.at
Sat Aug 7 09:44:20 EDT 2004
Log message for revision 26950:
Now also scans instancehome for stale bytecode.
Changed:
U Zope/trunk/test.py
-=-
Modified: Zope/trunk/test.py
===================================================================
--- Zope/trunk/test.py 2004-08-07 06:55:01 UTC (rev 26949)
+++ Zope/trunk/test.py 2004-08-07 13:44:20 UTC (rev 26950)
@@ -87,7 +87,7 @@
can be specified by using "-G OPTION1 -G OPTION2."
--import-testing
- Import the Testing module to setup the test ZODB. Useful for running
+ Import the Testing package to setup the test ZODB. Useful for running
tests that forgot to "import Testing".
--libdir test_root
@@ -371,7 +371,7 @@
self.libdir = "lib/python"
# Hack sys.path
self.home = os.path.dirname(os.path.realpath(sys.argv[0]))
- # test.py lives in bin directory when installed ...
+ # test.py lives in $ZOPE_HOME/bin when installed ...
dir, file = os.path.split(self.home)
if file == 'bin': self.home = dir
sys.path.insert(0, os.path.join(self.home, self.libdir))
@@ -633,9 +633,15 @@
srcname = name[:-1]
if srcname not in names:
fullname = os.path.join(dirname, name)
- print "Removing stale bytecode file", fullname
- os.unlink(fullname)
+ print "Removing stale bytecode file", fullname,
+ try:
+ os.unlink(fullname)
+ except (OSError, IOError), e:
+ print ' --> %s (errno %d)' % (e.strerror, e.errno)
+ else:
+ print
+
def main(module_filter, test_filter, libdir):
global pathinit
global config_file
@@ -655,7 +661,15 @@
import Zope
Zope.configure(config_file)
- # Import Testing module to setup the test ZODB
+ if not keepStaleBytecode:
+ from App.config import getConfiguration
+ softwarehome = os.path.realpath(getConfiguration().softwarehome)
+ instancehome = os.path.realpath(getConfiguration().instancehome)
+ softwarehome = os.path.normcase(softwarehome)
+ if not softwarehome.startswith(os.path.normcase(instancehome)):
+ walk_with_symlinks(instancehome, remove_stale_bytecode, None)
+
+ # Import Testing package to setup the test ZODB
if import_testing:
import Testing
More information about the Zope-Checkins
mailing list