Mercurial > hg
changeset 21431:0f12bc8aed80
run-tests: teach unittest about ignored tests
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 20 Apr 2014 11:51:11 -0700 |
parents | cf2992656bf8 |
children | 1a46f9635ef0 |
files | tests/run-tests.py |
diffstat | 1 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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)