Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ Manuel Krebber
Marc Mueller
Marc Schlaich
Marcelo Duarte Trevisani
Marcin Augustynów
Marcin Bachry
Marc Bresson
Marco Gorelli
Expand Down
3 changes: 3 additions & 0 deletions changelog/12736.improvement.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Added a new attribute `name` with the fixed value `"pytest tests"` to the root tag `testsuites` of the junit-xml generated by pytest.

This attribute is part of many junit-xml specifications and is even part of the `junit-10.xsd` specification that pytest's implementation is based on.
1 change: 1 addition & 0 deletions src/_pytest/junitxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,7 @@ def pytest_sessionfinish(self) -> None:
for node_reporter in self.node_reporters_ordered:
suite_node.append(node_reporter.to_xml())
testsuites = ET.Element("testsuites")
testsuites.set("name", "pytest tests")
testsuites.append(suite_node)
logfile.write(ET.tostring(testsuites, encoding="unicode"))

Expand Down
1 change: 1 addition & 0 deletions testing/test_junitxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1451,6 +1451,7 @@ def test_x():
_, dom = run_and_parse(family=xunit_family)
root = dom.get_unique_child
assert root.tag == "testsuites"
root.assert_attr(name="pytest tests")
suite_node = root.get_unique_child
assert suite_node.tag == "testsuite"

Expand Down