# HG changeset patch # User Gregory Szorc # Date 1398029309 25200 # Node ID a6845a042d462a7abbe4f27a56d67bf4416cc4c7 # Parent 867a1116be3cb67c19baca9d6783e39ec4618421 run-tests: record ignored tests by raising IgnoreTest diff -r 867a1116be3c -r a6845a042d46 tests/run-tests.py --- a/tests/run-tests.py Sun Apr 20 14:23:50 2014 -0700 +++ b/tests/run-tests.py Sun Apr 20 14:28:29 2014 -0700 @@ -616,6 +616,9 @@ return 's', self.name, msg def ignore(self, msg): + if self._unittest: + raise IgnoreTest(msg) + return 'i', self.name, msg class PythonTest(Test): @@ -985,6 +988,9 @@ class SkipTest(Exception): """Raised to indicate that a test is to be skipped.""" +class IgnoreTest(Exception): + """Raised to indicate that a test is to be ignored.""" + class TestResult(unittest._TextTestResult): """Holds results when executing via unittest.""" # Don't worry too much about accessing the non-public _TextTestResult. @@ -1342,6 +1348,8 @@ raise except SkipTest, e: result.addSkip(self, str(e)) + except IgnoreTest, e: + result.addIgnore(self, str(e)) except self.failureException: result.addFailure(self, sys.exc_info()) except Exception: @@ -1356,10 +1364,8 @@ self._result.failures.append((self, msg)) elif code == '~': self._result.addWarn(self, msg) - elif code == 'i': - self._result.addIgnore(self, msg) # Codes handled in run(). - elif code in ('.', 's'): + elif code in ('.', 's', 'i'): pass else: self.fail('Unknown test result code: %s' % code)