tests/run-tests.py
changeset 21494 dcefc4091c86
parent 21493 b8f4854ea61a
child 21495 b162bdc78bef
equal deleted inserted replaced
21493:b8f4854ea61a 21494:dcefc4091c86
  1167                skipped + ignored, warned, failed))
  1167                skipped + ignored, warned, failed))
  1168         if failed:
  1168         if failed:
  1169             self.stream.writeln('python hash seed: %s' %
  1169             self.stream.writeln('python hash seed: %s' %
  1170                 os.environ['PYTHONHASHSEED'])
  1170                 os.environ['PYTHONHASHSEED'])
  1171         if self._runner.options.time:
  1171         if self._runner.options.time:
  1172             self._runner._outputtimes()
  1172             self.printtimes()
       
  1173 
       
  1174     def printtimes(self):
       
  1175         self.stream.writeln('# Producing time report')
       
  1176         self._runner.times.sort(key=lambda t: (t[1], t[0]), reverse=True)
       
  1177         cols = '%7.3f   %s'
       
  1178         self.stream.writeln('%-7s   %s' % ('Time', 'Test'))
       
  1179         for test, timetaken in self._runner.times:
       
  1180             self.stream.writeln(cols % (timetaken, test))
  1173 
  1181 
  1174 class TestRunner(object):
  1182 class TestRunner(object):
  1175     """Holds context for executing tests.
  1183     """Holds context for executing tests.
  1176 
  1184 
  1177     Tests rely on a lot of state. This object holds it for them.
  1185     Tests rely on a lot of state. This object holds it for them.
  1562         finally:
  1570         finally:
  1563             pipe.close()
  1571             pipe.close()
  1564 
  1572 
  1565         return self._hgpath
  1573         return self._hgpath
  1566 
  1574 
  1567     def _outputtimes(self):
       
  1568         vlog('# Producing time report')
       
  1569         self.times.sort(key=lambda t: (t[1], t[0]), reverse=True)
       
  1570         cols = '%7.3f   %s'
       
  1571         print '\n%-7s   %s' % ('Time', 'Test')
       
  1572         for test, timetaken in self.times:
       
  1573             print cols % (timetaken, test)
       
  1574 
       
  1575     def _outputcoverage(self):
  1575     def _outputcoverage(self):
  1576         vlog('# Producing coverage report')
  1576         vlog('# Producing coverage report')
  1577         os.chdir(self.pythondir)
  1577         os.chdir(self.pythondir)
  1578 
  1578 
  1579         def covrun(*args):
  1579         def covrun(*args):