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.
--- 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)