[Zope-Checkins] CVS: Zope3 - test.py:1.1.2.6
Guido van Rossum
guido@python.org
Thu, 28 Mar 2002 20:29:43 -0500
Update of /cvs-repository/Zope3
In directory cvs.zope.org:/tmp/cvs-serv20741
Modified Files:
Tag: Zope-3x-branch
test.py
Log Message:
Before running tests, remove all stale .pyc and .pyo files.
Hopefully this will prevent future generations the kind of
embarrasment that befell Casey Duncan tonight: he removed various
files that were still in use, but didn't notice (probably) because the
.pyc files were still there.
=== Zope3/test.py 1.1.2.5 => 1.1.2.6 ===
r = runner.run(suite)
+def remove_stale_bytecode(arg, dirname, names):
+ for name in names:
+ name = os.path.normcase(name)
+ if name.endswith(".pyc") or name.endswith(".pyo"):
+ srcname = name[:-1]
+ if srcname not in names:
+ fullname = os.path.join(dirname, name)
+ print "Removing stale bytecode file", fullname
+ os.unlink(fullname)
+
def main(module_filter, test_filter):
+ os.path.walk(os.curdir, remove_stale_bytecode, None)
setup_path()
files = find_tests(module_filter)
files.sort()