fix issue575: xunit-xml reporting collection errors as failures

This commit is contained in:
Bruno Oliveira 2014-09-15 22:04:46 -03:00
parent 6aa5611ae5
commit 418607846a
3 changed files with 9 additions and 6 deletions

View File

@ -1,6 +1,9 @@
NEXT 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 - fix issue582: fix setuptools example, thanks Laszlo Papp and Ronny
Pfannschmidt. Pfannschmidt.

View File

@ -129,10 +129,10 @@ class LogXML(object):
self.failed += 1 self.failed += 1
self._write_captured_output(report) self._write_captured_output(report)
def append_collect_failure(self, report): def append_collect_error(self, report):
#msg = str(report.longrepr.reprtraceback.extraline) #msg = str(report.longrepr.reprtraceback.extraline)
self.append(Junit.failure(bin_xml_escape(report.longrepr), self.append(Junit.error(bin_xml_escape(report.longrepr),
message="collection failure")) message="collection failure"))
self.errors += 1 self.errors += 1
def append_collect_skipped(self, report): def append_collect_skipped(self, report):
@ -181,7 +181,7 @@ class LogXML(object):
if not report.passed: if not report.passed:
self._opentestcase(report) self._opentestcase(report)
if report.failed: if report.failed:
self.append_collect_failure(report) self.append_collect_error(report)
else: else:
self.append_collect_skipped(report) self.append_collect_skipped(report)

View File

@ -252,7 +252,7 @@ class TestPython:
assert_attr(tnode, assert_attr(tnode,
#classname="test_collect_error", #classname="test_collect_error",
name="test_collect_error") name="test_collect_error")
fnode = tnode.getElementsByTagName("failure")[0] fnode = tnode.getElementsByTagName("error")[0]
assert_attr(fnode, message="collection failure") assert_attr(fnode, message="collection failure")
assert "SyntaxError" in fnode.toxml() assert "SyntaxError" in fnode.toxml()
@ -489,7 +489,7 @@ def test_unicode_issue368(testdir):
log.pytest_sessionstart() log.pytest_sessionstart()
log._opentestcase(report) log._opentestcase(report)
log.append_failure(report) log.append_failure(report)
log.append_collect_failure(report) log.append_collect_error(report)
log.append_collect_skipped(report) log.append_collect_skipped(report)
log.append_error(report) log.append_error(report)
report.longrepr = "filename", 1, ustr report.longrepr = "filename", 1, ustr