Comments
Patch
@@ -379,24 +379,16 @@ def terminate(proc):
getattr(proc, 'terminate', lambda : os.kill(proc.pid, signal.SIGTERM))()
except OSError:
pass
def killdaemons(pidfile):
return killmod.killdaemons(pidfile, tryhard=False, remove=True,
logfn=vlog)
-def outputtimes(options):
- vlog('# Producing time report')
- times.sort(key=lambda t: (t[1], t[0]), reverse=True)
- cols = '%7.3f %s'
- print '\n%-7s %s' % ('Time', 'Test')
- for test, timetaken in times:
- print cols % (timetaken, test)
-
def outputcoverage(runner):
vlog('# Producing coverage report')
os.chdir(runner.pythondir)
def covrun(*args):
cmd = 'coverage %s' % ' '.join(args)
vlog('# Running: %s' % cmd)
@@ -1119,17 +1111,17 @@ def runtests(runner, tests):
for s in results['!']:
print "Failed %s: %s" % s
runner.checkhglib("Tested")
print "# Ran %d tests, %d skipped, %d warned, %d failed." % (
tested, skipped + ignored, warned, failed)
if results['!']:
print 'python hash seed:', os.environ['PYTHONHASHSEED']
if runner.options.time:
- outputtimes(runner.options)
+ runner.outputtimes()
if runner.options.anycoverage:
outputcoverage(runner)
except KeyboardInterrupt:
failed = True
print "\ninterrupted!"
if failed:
@@ -1294,16 +1286,24 @@ class TestRunner(object):
the one we expect it to be. If not, print a warning to stderr."""
expecthg = os.path.join(self.pythondir, 'mercurial')
actualhg = _gethgpath()
if os.path.abspath(actualhg) != os.path.abspath(expecthg):
sys.stderr.write('warning: %s with unexpected mercurial lib: %s\n'
' (expected %s)\n'
% (verb, actualhg, expecthg))
+ def outputtimes(self):
+ vlog('# Producing time report')
+ times.sort(key=lambda t: (t[1], t[0]), reverse=True)
+ cols = '%7.3f %s'
+ print '\n%-7s %s' % ('Time', 'Test')
+ for test, timetaken in times:
+ print cols % (timetaken, test)
+
def main(args, parser=None):
runner = TestRunner()
parser = parser or getparser()
(options, args) = parseargs(args, parser)
runner.options = options
os.umask(022)