changeset 21441:213339e9bada

run-tests: implement TestCase.run() Simply wrapping TestCase.run() is not sufficient for robust results reporting because unittest in Python 2.4 does not know about things like skipped tests and reports them as success or failures instead of skips. We will reimplement TestCase.run() with knowledge and semantics present in modern Python releases.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 20 Apr 2014 14:19:59 -0700
parents ece127734db1
children 867a1116be3c
files tests/run-tests.py
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Sun Apr 20 14:04:37 2014 -0700
+++ b/tests/run-tests.py	Sun Apr 20 14:19:59 2014 -0700
@@ -1330,7 +1330,16 @@
             def run(self, result):
                 self._result = result
 
-                return super(MercurialTest, self).run(result)
+                try:
+                    self.runTest()
+                except KeyboardInterrupt:
+                    raise
+                except self.failureException:
+                    result.addFailure(self, sys.exc_info())
+                except Exception:
+                    result.addError(self, sys.exc_info())
+                else:
+                    result.addSuccess(self)
 
             def runTest(self):
                 code, tname, msg = t.run()