Mercurial > hg-stable
changeset 21443:a6845a042d46
run-tests: record ignored tests by raising IgnoreTest
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 20 Apr 2014 14:28:29 -0700 |
parents | 867a1116be3c |
children | 2b7d364690d8 |
files | tests/run-tests.py |
diffstat | 1 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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)