Show XFail reason as part of JUnitXML message field

Fixes #4907
This commit is contained in:
Samuel Searles-Bryant
2019-04-10 23:07:57 +01:00
parent 97cd5f0deb
commit a37d1df089
4 changed files with 29 additions and 2 deletions

View File

@@ -252,7 +252,14 @@ class _NodeReporter(object):
def append_skipped(self, report):
if hasattr(report, "wasxfail"):
self._add_simple(Junit.skipped, "expected test failure", report.wasxfail)
xfailreason = report.wasxfail
if xfailreason.startswith("reason: "):
xfailreason = xfailreason[8:]
self.append(
Junit.skipped(
"", type="pytest.xfail", message=bin_xml_escape(xfailreason)
)
)
else:
filename, lineno, skipreason = report.longrepr
if skipreason.startswith("Skipped: "):