run-tests: move outputtimes() into unittest runner class
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 20 Apr 2014 17:28:24 -0700
changeset 21494 dcefc4091c86
parent 21493 b8f4854ea61a
child 21495 b162bdc78bef
run-tests: move outputtimes() into unittest runner class The unittest runner now does all the printing. Move outputtimes() there.
tests/run-tests.py
--- 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)