run-tests: teach unittest about ignored tests
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 20 Apr 2014 11:51:11 -0700
changeset 21431 0f12bc8aed80
parent 21430 cf2992656bf8
child 21432 1a46f9635ef0
run-tests: teach unittest about ignored tests
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)