comparison tests/run-tests.py @ 21613:b3213b9fafed

run-tests: exit with non-0 exit code when tests fail or warn As part of the run-tests.py refactor, run-tests.py accidentally started exiting with 0 for most test runs. This patch restores the expected behavior.
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 27 May 2014 19:10:22 -0700
parents 0c4077905932
children 609a642dff61
comparison
equal deleted inserted replaced
21612:f221eb0531d9 21613:b3213b9fafed
1316 self.stream.writeln('python hash seed: %s' % 1316 self.stream.writeln('python hash seed: %s' %
1317 os.environ['PYTHONHASHSEED']) 1317 os.environ['PYTHONHASHSEED'])
1318 if self._runner.options.time: 1318 if self._runner.options.time:
1319 self.printtimes(result.times) 1319 self.printtimes(result.times)
1320 1320
1321 return result
1322
1321 def printtimes(self, times): 1323 def printtimes(self, times):
1322 self.stream.writeln('# Producing time report') 1324 self.stream.writeln('# Producing time report')
1323 times.sort(key=lambda t: (t[1], t[0]), reverse=True) 1325 times.sort(key=lambda t: (t[1], t[0]), reverse=True)
1324 cols = '%7.3f %s' 1326 cols = '%7.3f %s'
1325 self.stream.writeln('%-7s %s' % ('Time', 'Test')) 1327 self.stream.writeln('%-7s %s' % ('Time', 'Test'))
1535 tests=tests) 1537 tests=tests)
1536 verbosity = 1 1538 verbosity = 1
1537 if self.options.verbose: 1539 if self.options.verbose:
1538 verbosity = 2 1540 verbosity = 2
1539 runner = TextTestRunner(self, verbosity=verbosity) 1541 runner = TextTestRunner(self, verbosity=verbosity)
1540 runner.run(suite) 1542 result = runner.run(suite)
1543
1544 if result.failures:
1545 failed = True
1546 if result.warned:
1547 warned = True
1541 1548
1542 if self.options.anycoverage: 1549 if self.options.anycoverage:
1543 self._outputcoverage() 1550 self._outputcoverage()
1544 except KeyboardInterrupt: 1551 except KeyboardInterrupt:
1545 failed = True 1552 failed = True