[Zope-Checkins] CVS: Zope - test.py:1.2.2.12
Stefan H. Holek
stefan at epy.co.at
Sat Aug 7 09:44:45 EDT 2004
Update of /cvs-repository/Zope
In directory cvs.zope.org:/tmp/cvs-serv20773
Modified Files:
Tag: Zope-2_7-branch
test.py
Log Message:
Now also scans instancehome for stale bytecode.
=== Zope/test.py 1.2.2.11 => 1.2.2.12 ===
--- Zope/test.py:1.2.2.11 Fri Aug 6 05:47:42 2004
+++ Zope/test.py Sat Aug 7 09:44:44 2004
@@ -54,7 +54,7 @@
-C filename
Shortcut for --config-file filename.
-
+
-d
Instead of the normal test harness, run a debug version which
doesn't catch any exceptions. This is occasionally handy when the
@@ -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,8 +633,14 @@
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
@@ -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