comparison tests/run-tests.py @ 32934:6123a5267119

tests: remove WarnTest We would raise this if a test didn't return a result code. AFAICT this can only occur if there is a logic error in the test harness itself. I don't think it is worth the code complexity to distinguish this failure scenario from a regular test failure.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 03 Jun 2017 17:13:35 -0700
parents f83b7376a300
children 5af78c524f34
comparison
equal deleted inserted replaced
32933:f83b7376a300 32934:6123a5267119
715 result.addSkip(self, str(e)) 715 result.addSkip(self, str(e))
716 # The base class will have already counted this as a 716 # The base class will have already counted this as a
717 # test we "ran", but we want to exclude skipped tests 717 # test we "ran", but we want to exclude skipped tests
718 # from those we count towards those run. 718 # from those we count towards those run.
719 result.testsRun -= 1 719 result.testsRun -= 1
720 except WarnTest as e:
721 result.addWarn(self, str(e))
722 except ReportedTest as e: 720 except ReportedTest as e:
723 pass 721 pass
724 except self.failureException as e: 722 except self.failureException as e:
725 # This differs from unittest in that we don't capture 723 # This differs from unittest in that we don't capture
726 # the stack trace. This is for historical reasons and 724 # the stack trace. This is for historical reasons and
786 self._skipped = True 784 self._skipped = True
787 raise unittest.SkipTest(missing[-1]) 785 raise unittest.SkipTest(missing[-1])
788 elif ret == 'timeout': 786 elif ret == 'timeout':
789 self.fail('timed out') 787 self.fail('timed out')
790 elif ret is False: 788 elif ret is False:
791 raise WarnTest('no result code from test') 789 self.fail('no result code from test')
792 elif out != self._refout: 790 elif out != self._refout:
793 # Diff generation may rely on written .err file. 791 # Diff generation may rely on written .err file.
794 if (ret != 0 or out != self._refout) and not self._skipped \ 792 if (ret != 0 or out != self._refout) and not self._skipped \
795 and not self._debug: 793 and not self._debug:
796 f = open(self.errpath, 'wb') 794 f = open(self.errpath, 'wb')
1479 def _stringescape(s): 1477 def _stringescape(s):
1480 return TTest.ESCAPESUB(TTest._escapef, s) 1478 return TTest.ESCAPESUB(TTest._escapef, s)
1481 1479
1482 iolock = threading.RLock() 1480 iolock = threading.RLock()
1483 1481
1484 class WarnTest(Exception):
1485 """Raised to indicate that a test warned."""
1486
1487 class ReportedTest(Exception): 1482 class ReportedTest(Exception):
1488 """Raised to indicate that a test already reported.""" 1483 """Raised to indicate that a test already reported."""
1489 1484
1490 class TestResult(unittest._TextTestResult): 1485 class TestResult(unittest._TextTestResult):
1491 """Holds results when executing via unittest.""" 1486 """Holds results when executing via unittest."""