Skip to content
Snippets Groups Projects
Commit a6845a04 authored by Gregory Szorc's avatar Gregory Szorc
Browse files

run-tests: record ignored tests by raising IgnoreTest

parent 867a1116
No related branches found
No related tags found
No related merge requests found
......@@ -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,6 +1364,4 @@
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().
......@@ -1361,5 +1367,5 @@
# Codes handled in run().
elif code in ('.', 's'):
elif code in ('.', 's', 'i'):
pass
else:
self.fail('Unknown test result code: %s' % code)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment