# HG changeset patch # User Gregory Szorc # Date 1398019871 25200 # Node ID 0f12bc8aed80fde7a100423891e55a7b500c1467 # Parent cf2992656bf8062e0e6fcfcf5ffd11989ecdc72b run-tests: teach unittest about ignored tests diff -r cf2992656bf8 -r 0f12bc8aed80 tests/run-tests.py --- a/tests/run-tests.py Sun Apr 20 11:48:19 2014 -0700 +++ b/tests/run-tests.py Sun Apr 20 11:51:11 2014 -0700 @@ -993,6 +993,11 @@ # 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 @@ 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 @@ 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)