Commit ddcb5001 authored by Julien Muchembled's avatar Julien Muchembled

Mark test as FAILED in case of "unexpected success

parent c21768a8
...@@ -332,11 +332,12 @@ class ERP5TypeTestSuite(TestSuite): ...@@ -332,11 +332,12 @@ class ERP5TypeTestSuite(TestSuite):
search = self.STATUS_RE.search(test_log) search = self.STATUS_RE.search(test_log)
if search: if search:
groupdict = search.groupdict() groupdict = search.groupdict()
status_dict.update(error_count=int(groupdict['errors'] or 0), status_dict.update(
failure_count=int(groupdict['failures'] or 0), error_count=int(groupdict['errors'] or 0),
skip_count=int(groupdict['skips'] or 0) failure_count=int(groupdict['failures'] or 0)
+int(groupdict['expected_failures'] or 0) +int(groupdict['unexpected_successes'] or 0),
+int(groupdict['unexpected_successes'] or 0)) skip_count=int(groupdict['skips'] or 0)
+int(groupdict['expected_failures'] or 0))
return status_dict return status_dict
......
...@@ -233,11 +233,12 @@ class ERP5TypeTestSuite(TestSuite): ...@@ -233,11 +233,12 @@ class ERP5TypeTestSuite(TestSuite):
search = self.STATUS_RE.search(test_log) search = self.STATUS_RE.search(test_log)
if search: if search:
groupdict = search.groupdict() groupdict = search.groupdict()
status_dict.update(error_count=int(groupdict['errors'] or 0), status_dict.update(
failure_count=int(groupdict['failures'] or 0), error_count=int(groupdict['errors'] or 0),
skip_count=int(groupdict['skips'] or 0) failure_count=int(groupdict['failures'] or 0)
+int(groupdict['expected_failures'] or 0) +int(groupdict['unexpected_successes'] or 0),
+int(groupdict['unexpected_successes'] or 0)) skip_count=int(groupdict['skips'] or 0)
+int(groupdict['expected_failures'] or 0))
return status_dict return status_dict
class ProjectTestSuite(ERP5TypeTestSuite): class ProjectTestSuite(ERP5TypeTestSuite):
......
...@@ -207,6 +207,10 @@ class _TextTestResult(unittest._TextTestResult, TestResult): ...@@ -207,6 +207,10 @@ class _TextTestResult(unittest._TextTestResult, TestResult):
unittest._TextTestResult.__init__(self, stream, descriptions, verbosity) unittest._TextTestResult.__init__(self, stream, descriptions, verbosity)
TestResult.__init__(self) TestResult.__init__(self)
def wasSuccessful(self):
"Tells whether or not this result was a success"
return not (self.failures or self.errors or self.unexpectedSuccesses)
def addSkip(self, test, reason): def addSkip(self, test, reason):
super(_TextTestResult, self).addSkip(test, reason) super(_TextTestResult, self).addSkip(test, reason)
if self.showAll: if self.showAll:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment