run-tests: start to report test results against TestResult
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 20 Apr 2014 11:29:39 -0700
changeset 21428 3df2ecf8d545
parent 21427 60f944758ad4
child 21429 203ed3cf6c81
run-tests: start to report test results against TestResult Previously, our unittest wrapper didn't report results properly. We now properly report failures. We had to rename the local variable to prevent "t" from being overwritten in the local scope.
tests/run-tests.py
--- a/tests/run-tests.py	Sun Apr 20 11:24:37 2014 -0700
+++ b/tests/run-tests.py	Sun Apr 20 11:29:39 2014 -0700
@@ -1259,8 +1259,28 @@
             def shortDescription(self):
                 return self.name
 
+            # Need to stash away the TestResult since we do custom things
+            # with it.
+            def run(self, result):
+                self._result = result
+
+                return super(MercurialTest, self).run(result)
+
             def runTest(self):
-                t.run()
+                code, tname, msg = t.run()
+
+                if code == '!':
+                    self._result.failures.append((self, msg))
+                elif code == '~':
+                    pass
+                elif code == '.':
+                    pass
+                elif code == 's':
+                    pass
+                elif code == 'i':
+                    pass
+                else:
+                    self.fail('Unknown test result code: %s' % code)
 
         return MercurialTest(test)