[Zope-Checkins] CVS: Zope/utilities - testrunner.py:1.15.20.1
Tres Seaver
tseaver@zope.com
Sat, 13 Oct 2001 16:44:11 -0400
Update of /cvs-repository/Zope/utilities
In directory cvs.zope.org:/tmp/cvs-serv27736/utilities
Modified Files:
Tag: tseaver-utxfixup-branch
testrunner.py
Log Message:
- utilities/testrunner: added check for '.testinfo' file when traversing
a directory; if found, its contents are used to determine further
traversal, in preference to raw 'listdir' (allows suppression or
re-ordering of tests).
- lib/python/.testinfo: Move AccessControl tests to end of sequence
(they all run then?!?)
- lib/python/SearchIndex/.testinfo: Suppress tests for deprecated
package.
=== Zope/utilities/testrunner.py 1.15 => 1.15.20.1 ===
def report(self, message):
- print message
- print
+ sys.stderr.write( '%s\n' % message )
def runAllTests(self):
"""Run all tests found in the current working directory and
@@ -97,6 +96,13 @@
if not os.path.isabs(pathname):
pathname = os.path.join(self.basepath, pathname)
names=os.listdir(pathname)
+ if '.testinfo' in names: # allow local control
+ f = open( os.path.join( pathname, '.testinfo' ) )
+ lines = filter( None, f.readlines() )
+ lines = map( lambda x: x[-1]=='\n' and x[:-1] or x, lines )
+ names = filter( lambda x: x and x[0] != '#', lines )
+ f.close()
+ print '.testinfo: %s' % names
for name in names:
fullpath=os.path.join(pathname, name)
if os.path.isdir(fullpath):
@@ -109,6 +115,8 @@
working_dir = os.getcwd()
dirname, name = os.path.split(filename)
if dirname:
+ if self.verbosity > 2:
+ sys.stderr.write( '*** Changing directory to: %s\n' % dirname )
os.chdir(dirname)
self.report('Running: %s' % filename)
try: suite=self.getSuiteFromFile(name)
@@ -119,6 +127,8 @@
self.runSuite(suite)
else:
self.report('No test suite found in file:\n%s\n' % filename)
+ if self.verbosity > 2:
+ sys.stderr.write( '*** Restoring directory to: %s\n' % working_dir )
os.chdir(working_dir)