# HG changeset patch # User Gregory Szorc # Date 1398019699 25200 # Node ID cf2992656bf8062e0e6fcfcf5ffd11989ecdc72b # Parent 203ed3cf6c81c33ee76bbfb9ec3951237fae1fb0 run-tests: teach unittest about skipped tests diff -r 203ed3cf6c81 -r cf2992656bf8 tests/run-tests.py --- a/tests/run-tests.py Sun Apr 20 11:47:40 2014 -0700 +++ b/tests/run-tests.py Sun Apr 20 11:48:19 2014 -0700 @@ -989,6 +989,20 @@ def __init__(self, *args, **kwargs): super(TestResult, self).__init__(*args, **kwargs) + # unittest.TestResult didn't have skipped until 2.7. We need to + # polyfill it. + self.skipped = [] + + # Polyfill. + def addSkip(self, test, reason): + self.skipped.append((test, reason)) + + if self.showAll: + self.stream.writeln('skipped %s' % reason) + else: + self.stream.write('s') + self.stream.flush() + class TextTestRunner(unittest.TextTestRunner): """Custom unittest test runner that uses appropriate settings.""" @@ -1289,7 +1303,7 @@ elif code == '.': pass elif code == 's': - pass + self._result.addSkip(self, msg) elif code == 'i': pass else: