Fix double <system-out> entry in junit.xml

check it system-out already exists
if this is the case append text
This commit is contained in:
Kai Kasprowsky 2023-03-27 15:03:17 +02:00
parent 2369bed1db
commit ca782ca4f3
3 changed files with 14 additions and 3 deletions

1
10841.improvement.rst Normal file
View File

@ -0,0 +1 @@
only create <system-out> in junit.xml once for each test.

View File

@ -189,6 +189,7 @@ Joshua Bronson
Jurko Gospodnetić Jurko Gospodnetić
Justice Ndou Justice Ndou
Justyna Janczyszyn Justyna Janczyszyn
Kai Kasprowsky
Kale Kundert Kale Kundert
Kamran Ahmad Kamran Ahmad
Karl O. Pinc Karl O. Pinc

View File

@ -186,6 +186,15 @@ class _NodeReporter:
return "\n".join([header.center(80, "-"), content, ""]) return "\n".join([header.center(80, "-"), content, ""])
def _write_content(self, report: TestReport, content: str, jheader: str) -> None: def _write_content(self, report: TestReport, content: str, jheader: str) -> None:
exists = False
for elem in next(iter(self.xml.node_reporters.values())).nodes:
if jheader in elem.tag:
exists = True
tag = elem
tag.text = (
tag.text + bin_xml_escape(content) if tag.text is not None else None
)
if not exists:
tag = ET.Element(jheader) tag = ET.Element(jheader)
tag.text = bin_xml_escape(content) tag.text = bin_xml_escape(content)
self.append(tag) self.append(tag)