changeset 21462:8a4ef661f08d

run-tests: make failure reporting in unittest mode equivalent to default Unlike unittest's defaults, our result formatter does not print stack traces. Here, we change TestResult.addFailure() to be compatible with the existing/default execution mode.
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 21 Apr 2014 12:15:55 -0700
parents a46a91989d57
children c908ff887589
files tests/run-tests.py
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Sun Apr 20 16:54:51 2014 -0700
+++ b/tests/run-tests.py	Mon Apr 21 12:15:55 2014 -0700
@@ -1067,8 +1067,8 @@
         # sense to map it into fail some day.
         self.warned = []
 
-    def addFailure(self, *args, **kwargs):
-        super(TestResult, self).addFailure(*args, **kwargs)
+    def addFailure(self, test, reason):
+        self.failures.append((test, reason))
 
         if self._options.first:
             self.stop()
@@ -1472,8 +1472,12 @@
                         result.addIgnore(self, str(e))
                     except WarnTest, e:
                         result.addWarn(self, str(e))
-                    except self.failureException:
-                        result.addFailure(self, sys.exc_info())
+                    except self.failureException, e:
+                        # This differs from unittest in that we don't capture
+                        # the stack trace. This is for historical reasons and
+                        # this decision could be revisted in the future,
+                        # especially for PythonTest instances.
+                        result.addFailure(self, str(e))
                     except Exception:
                         result.addError(self, sys.exc_info())
                     else: