Bug 1349516 - Add support to pytest-mozlog for tests rerun using pytest-rerunfailures; r=ahal
authorDave Hunt <dhunt@mozilla.com>
Thu, 20 Jul 2017 18:03:11 +0100
changeset 423298 d6eb564eef59e3b488de37cac4c9077dd4c80a38
parent 423297 3ba4ec951216ff5ccdebd1062f8f5c4a61e0ae32
child 423299 b6a01f3ac7046300a8cdd4bab80417e0d1e85b7d
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs1349516
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1349516 - Add support to pytest-mozlog for tests rerun using pytest-rerunfailures; r=ahal MozReview-Commit-ID: GrFaW74EwXC
testing/mozbase/mozlog/mozlog/pytest_mozlog/plugin.py
--- a/testing/mozbase/mozlog/mozlog/pytest_mozlog/plugin.py
+++ b/testing/mozbase/mozlog/mozlog/pytest_mozlog/plugin.py
@@ -76,17 +76,17 @@ class MozLog(object):
 
     def pytest_runtest_logreport(self, report):
         '''Called 3 times per test (setup, call, teardown), indicated by report.when'''
         test = report.nodeid
         status = expected = 'PASS'
         message = stack = None
         if hasattr(report, 'wasxfail'):
             expected = 'FAIL'
-        if report.failed:
+        if report.failed or report.outcome == 'rerun':
             status = 'FAIL' if report.when == 'call' else 'ERROR'
         if report.skipped:
             status = 'SKIP' if not hasattr(report, 'wasxfail') else 'FAIL'
         if report.longrepr is not None:
             longrepr = report.longrepr
             if isinstance(longrepr, basestring):
                 # When using pytest-xdist, longrepr is serialised as a str
                 message = stack = longrepr
@@ -105,13 +105,13 @@ class MozLog(object):
             elif hasattr(longrepr, "__getitem__") and len(longrepr) == 3:
                 # For skips, longrepr is a tuple of (file, lineno, reason)
                 message = report.longrepr[-1]
             else:
                 raise ValueError("Unable to convert longrepr to message:\ntype %s\nfields:" %
                                  (longrepr.__class__, dir(longrepr)))
         if status != expected or expected != 'PASS':
             self.results[test] = (status, expected, message, stack)
-        if report.when == 'teardown':
+        if report.outcome == 'rerun' or report.when == 'teardown':
             defaults = ('PASS', 'PASS', None, None)
             status, expected, message, stack = self.results.get(test, defaults)
             self.logger.test_end(test=test, status=status, expected=expected,
                                  message=message, stack=stack)