# HG changeset patch # User Gregory Szorc # Date 2014-04-20 18:51:11 # Node ID 0f12bc8aed80fde7a100423891e55a7b500c1467 # Parent cf2992656bf8062e0e6fcfcf5ffd11989ecdc72b run-tests: teach unittest about ignored tests diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -993,6 +993,11 @@ class TestResult(unittest._TextTestResul # polyfill it. self.skipped = [] + # We have a custom "ignored" result that isn't present in any Python + # unittest implementation. It is very similar to skipped. It may make + # sense to map it into skip some day. + self.ignored = [] + # Polyfill. def addSkip(self, test, reason): self.skipped.append((test, reason)) @@ -1003,6 +1008,15 @@ class TestResult(unittest._TextTestResul self.stream.write('s') self.stream.flush() + def addIgnore(self, test, reason): + self.ignored.append((test, reason)) + + if self.showAll: + self.stream.writeln('ignored %s' % reason) + else: + self.stream.write('i') + self.stream.flush() + class TextTestRunner(unittest.TextTestRunner): """Custom unittest test runner that uses appropriate settings.""" @@ -1305,7 +1319,7 @@ class TestRunner(object): elif code == 's': self._result.addSkip(self, msg) elif code == 'i': - pass + self._result.addIgnore(self, msg) else: self.fail('Unknown test result code: %s' % code)