Mercurial > hg-stable
changeset 21494:dcefc4091c86
run-tests: move outputtimes() into unittest runner class
The unittest runner now does all the printing. Move outputtimes() there.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 20 Apr 2014 17:28:24 -0700 |
parents | b8f4854ea61a |
children | b162bdc78bef |
files | tests/run-tests.py |
diffstat | 1 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/run-tests.py Sun Apr 20 17:21:24 2014 -0700 +++ b/tests/run-tests.py Sun Apr 20 17:28:24 2014 -0700 @@ -1169,7 +1169,15 @@ self.stream.writeln('python hash seed: %s' % os.environ['PYTHONHASHSEED']) if self._runner.options.time: - self._runner._outputtimes() + self.printtimes() + + def printtimes(self): + self.stream.writeln('# Producing time report') + self._runner.times.sort(key=lambda t: (t[1], t[0]), reverse=True) + cols = '%7.3f %s' + self.stream.writeln('%-7s %s' % ('Time', 'Test')) + for test, timetaken in self._runner.times: + self.stream.writeln(cols % (timetaken, test)) class TestRunner(object): """Holds context for executing tests. @@ -1564,14 +1572,6 @@ return self._hgpath - def _outputtimes(self): - vlog('# Producing time report') - self.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 self.times: - print cols % (timetaken, test) - def _outputcoverage(self): vlog('# Producing coverage report') os.chdir(self.pythondir)