Skip to content

Commit 2b51ed4

Browse files
authored
Merge pull request #7153 from nicoddemus/xunit-warning-update
2 parents 0b78983 + 095a195 commit 2b51ed4

File tree

2 files changed

+28
-10
lines changed

2 files changed

+28
-10
lines changed

doc/en/deprecations.rst

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,40 @@ Note that ``from_parent`` should only be called with keyword arguments for the p
8080

8181
.. deprecated:: 5.2
8282

83-
The default value of ``junit_family`` option will change to ``xunit2`` in pytest 6.0, given
84-
that this is the version supported by default in modern tools that manipulate this type of file.
83+
The default value of ``junit_family`` option will change to ``xunit2`` in pytest 6.0, which
84+
is an update of the old ``xunit1`` format and is supported by default in modern tools
85+
that manipulate this type of file (for example, Jenkins, Azure Pipelines, etc.).
8586

86-
In order to smooth the transition, pytest will issue a warning in case the ``--junitxml`` option
87-
is given in the command line but ``junit_family`` is not explicitly configured in ``pytest.ini``::
87+
Users are recommended to try the new ``xunit2`` format and see if their tooling that consumes the JUnit
88+
XML file supports it.
8889

89-
PytestDeprecationWarning: The 'junit_family' default value will change to 'xunit2' in pytest 6.0.
90-
Add 'junit_family=legacy' to your pytest.ini file to silence this warning and make your suite compatible.
90+
To use the new format, update your ``pytest.ini``:
9191

92-
In order to silence this warning, users just need to configure the ``junit_family`` option explicitly:
92+
.. code-block:: ini
93+
94+
[pytest]
95+
junit_family=xunit2
96+
97+
If you discover that your tooling does not support the new format, and want to keep using the
98+
legacy version, set the option to ``legacy`` instead:
9399

94100
.. code-block:: ini
95101
96102
[pytest]
97103
junit_family=legacy
98104
105+
By using ``legacy`` you will keep using the legacy/xunit1 format when upgrading to
106+
pytest 6.0, where the default format will be ``xunit2``.
107+
108+
In order to let users know about the transition, pytest will issue a warning in case
109+
the ``--junitxml`` option is given in the command line but ``junit_family`` is not explicitly
110+
configured in ``pytest.ini``.
111+
112+
Services known to support the ``xunit2`` format:
113+
114+
* `Jenkins <https://www.jenkins.io/>`__ with the `JUnit <https://plugins.jenkins.io/junit>`__ plugin.
115+
* `Azure Pipelines <https://azure.microsoft.com/en-us/services/devops/pipelines>`__.
116+
99117

100118
``funcargnames`` alias for ``fixturenames``
101119
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/_pytest/deprecated.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@
4949
)
5050

5151
JUNIT_XML_DEFAULT_FAMILY = PytestDeprecationWarning(
52-
"The 'junit_family' default value will change to 'xunit2' in pytest 6.0.\n"
53-
"Add 'junit_family=xunit1' to your pytest.ini file to keep the current format "
54-
"in future versions of pytest and silence this warning."
52+
"The 'junit_family' default value will change to 'xunit2' in pytest 6.0. See:\n"
53+
" https://docs.pytest.org/en/latest/deprecations.html#junit-family-default-value-change-to-xunit2\n"
54+
"for more information."
5555
)
5656

5757
NO_PRINT_LOGS = PytestDeprecationWarning(

0 commit comments

Comments
 (0)