Mercurial > hg
changeset 21433:ff4a270bd334
run-tests: teach unittest about warned results
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 20 Apr 2014 11:55:02 -0700 |
parents | 1a46f9635ef0 |
children | a264fca9181b |
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:52:41 2014 -0700 +++ b/tests/run-tests.py Sun Apr 20 11:55:02 2014 -0700 @@ -998,6 +998,11 @@ # sense to map it into skip some day. self.ignored = [] + # We have a custom "warned" result that isn't present in any Python + # unittest implementation. It is very similar to failed. It may make + # sense to map it into fail some day. + self.warned = [] + # Polyfill. def addSkip(self, test, reason): self.skipped.append((test, reason)) @@ -1017,6 +1022,15 @@ self.stream.write('i') self.stream.flush() + def addWarn(self, test, reason): + self.warned.append((test, reason)) + + if self.showAll: + self.stream.writeln('warned %s' % reason) + else: + self.stream.write('~') + self.stream.flush() + class TextTestRunner(unittest.TextTestRunner): """Custom unittest test runner that uses appropriate settings.""" @@ -1313,7 +1327,7 @@ if code == '!': self._result.failures.append((self, msg)) elif code == '~': - pass + self._result.addWarn(self, msg) elif code == '.': # Success is handled automatically by the built-in run(). pass