Skip to content

Commit

Permalink
twister: reports: Pretty print XML reports
Browse files Browse the repository at this point in the history
Pretty print XML reports with tab identation on levels for better
readability and ease text diff there as well.

Signed-off-by: Dmitrii Golovanov <[email protected]>
  • Loading branch information
golowanow committed Dec 15, 2024
1 parent 06e5d0f commit 0bdfc99
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions scripts/pylib/twister/twisterlib/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ def xunit_report_suites(self, json_file, filename):
eleTestsuite.attrib['skipped'] = f"{skips}"
eleTestsuite.attrib['tests'] = f"{total}"

ET.indent(eleTestsuites, space="\t", level=0)
result = ET.tostring(eleTestsuites)
with open(filename, 'wb') as report:
report.write(result)
Expand Down Expand Up @@ -280,6 +281,7 @@ def xunit_report(self, json_file, filename, selected_platform=None, full_report=
eleTestsuite.attrib['skipped'] = f"{skips}"
eleTestsuite.attrib['tests'] = f"{total}"

ET.indent(eleTestsuites, space="\t", level=0)
result = ET.tostring(eleTestsuites)
with open(filename, 'wb') as report:
report.write(result)
Expand Down

0 comments on commit 0bdfc99

Please sign in to comment.