changeset 21428:3df2ecf8d545

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.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 20 Apr 2014 11:29:39 -0700
parents 60f944758ad4
children 203ed3cf6c81
files tests/run-tests.py
diffstat 1 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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)