From f6246cf238031ac8bb9c2a0473aa53bb65bbca76 Mon Sep 17 00:00:00 2001 From: maugu Date: Fri, 2 May 2025 15:19:04 +0200 Subject: [PATCH 1/5] added name attribute to testsuites tag in junitxml, issue n. #12736 --- src/_pytest/junitxml.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/_pytest/junitxml.py b/src/_pytest/junitxml.py index ec9922ee7bd..dc35e3aac15 100644 --- a/src/_pytest/junitxml.py +++ b/src/_pytest/junitxml.py @@ -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")) From ca388a5887dffb83918a1cb34c43aa155c2d024f Mon Sep 17 00:00:00 2001 From: maugu Date: Fri, 2 May 2025 15:50:04 +0200 Subject: [PATCH 2/5] Added relevant test case in test_junixml.py and added myself to the AUTHORS file --- AUTHORS | 1 + testing/test_junitxml.py | 1 + 2 files changed, 2 insertions(+) diff --git a/AUTHORS b/AUTHORS index 7f742fb4083..1dfa55b131f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -275,6 +275,7 @@ Manuel Krebber Marc Mueller Marc Schlaich Marcelo Duarte Trevisani +Marcin Augustynów Marcin Bachry Marc Bresson Marco Gorelli diff --git a/testing/test_junitxml.py b/testing/test_junitxml.py index 4145f34ab14..504e4969039 100644 --- a/testing/test_junitxml.py +++ b/testing/test_junitxml.py @@ -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" From 7be030187a0859db588c8db8feb093923f83f894 Mon Sep 17 00:00:00 2001 From: maugu Date: Fri, 2 May 2025 16:02:45 +0200 Subject: [PATCH 3/5] fix broken user in changelog --- changelog/12736.improvement.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelog/12736.improvement.rst diff --git a/changelog/12736.improvement.rst b/changelog/12736.improvement.rst new file mode 100644 index 00000000000..f6218ff50b6 --- /dev/null +++ b/changelog/12736.improvement.rst @@ -0,0 +1,2 @@ +Added a new attribute, "name" with the fixed value "pytest tests" inside 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. From 09a133e1dd8ddc47cff47d1b55f26b1b5d4e9084 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 2 May 2025 13:02:35 -0300 Subject: [PATCH 4/5] Update changelog/12736.improvement.rst --- changelog/12736.improvement.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/changelog/12736.improvement.rst b/changelog/12736.improvement.rst index f6218ff50b6..8bd01294db1 100644 --- a/changelog/12736.improvement.rst +++ b/changelog/12736.improvement.rst @@ -1,2 +1,3 @@ -Added a new attribute, "name" with the fixed value "pytest tests" inside 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. +Added a new attribute, `name` with the fixed value `"pytest tests"` inside 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. From 33adcc36cf96ac5a7fd03e1ee51f1d14456cee2c Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 2 May 2025 13:03:20 -0300 Subject: [PATCH 5/5] Update 12736.improvement.rst --- changelog/12736.improvement.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/12736.improvement.rst b/changelog/12736.improvement.rst index 8bd01294db1..5fdb14e2ef5 100644 --- a/changelog/12736.improvement.rst +++ b/changelog/12736.improvement.rst @@ -1,3 +1,3 @@ -Added a new attribute, `name` with the fixed value `"pytest tests"` inside the root tag `testsuites` of the junit-xml generated by pytest. +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.