diff --git a/CHANGELOG b/CHANGELOG index 486690523..f9d5797a2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,9 @@ NEXT ----------- +- fix issue575: xunit-xml was reporting collection errors as failures + instead of errors, thanks Oleg Sinyavskiy. + - fix issue582: fix setuptools example, thanks Laszlo Papp and Ronny Pfannschmidt. diff --git a/_pytest/junitxml.py b/_pytest/junitxml.py index 2371e17ba..d63c23e6a 100644 --- a/_pytest/junitxml.py +++ b/_pytest/junitxml.py @@ -129,10 +129,10 @@ class LogXML(object): self.failed += 1 self._write_captured_output(report) - def append_collect_failure(self, report): + def append_collect_error(self, report): #msg = str(report.longrepr.reprtraceback.extraline) - self.append(Junit.failure(bin_xml_escape(report.longrepr), - message="collection failure")) + self.append(Junit.error(bin_xml_escape(report.longrepr), + message="collection failure")) self.errors += 1 def append_collect_skipped(self, report): @@ -181,7 +181,7 @@ class LogXML(object): if not report.passed: self._opentestcase(report) if report.failed: - self.append_collect_failure(report) + self.append_collect_error(report) else: self.append_collect_skipped(report) diff --git a/testing/test_junitxml.py b/testing/test_junitxml.py index 2c59d04e0..4bae13886 100644 --- a/testing/test_junitxml.py +++ b/testing/test_junitxml.py @@ -252,7 +252,7 @@ class TestPython: assert_attr(tnode, #classname="test_collect_error", name="test_collect_error") - fnode = tnode.getElementsByTagName("failure")[0] + fnode = tnode.getElementsByTagName("error")[0] assert_attr(fnode, message="collection failure") assert "SyntaxError" in fnode.toxml() @@ -489,7 +489,7 @@ def test_unicode_issue368(testdir): log.pytest_sessionstart() log._opentestcase(report) log.append_failure(report) - log.append_collect_failure(report) + log.append_collect_error(report) log.append_collect_skipped(report) log.append_error(report) report.longrepr = "filename", 1, ustr