You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As per our policy, the following features have been deprecated in the 5.X series and are now
2
+
removed:
3
+
4
+
* The ``funcargnames`` read-only property of ``FixtureRequest``, ``Metafunc``, and ``Function`` classes. Use ``fixturenames`` attribute.
5
+
6
+
* ``@pytest.fixture`` no longer supports positional arguments, pass all arguments by keyword instead.
7
+
8
+
* Direct construction of ``Node`` subclasses now raise an error, use ``from_parent`` instead.
9
+
10
+
* The default value for ``junit_family`` has changed to ``xunit2``. If you require the old format, add ``junit_family=xunit1`` to your configuration file.
11
+
12
+
* The ``TerminalReporter`` no longer has a ``writer`` attribute. Plugin authors may use the public functions of the ``TerminalReporter`` instead of accessing the ``TerminalWriter`` object directly.
13
+
14
+
* The ``--result-log`` option has been removed. Users are recommended to use the `pytest-reportlog <https://github.com/pytest-dev/pytest-reportlog>`__ plugin instead.
15
+
16
+
17
+
For more information consult
18
+
`Deprecations and Removals <https://docs.pytest.org/en/stable/deprecations.html>`__ in the docs.
The construction of nodes now should use the named constructor ``from_parent``.
68
-
This limitation in api surface intends to enable better/simpler refactoring of the collection tree.
81
+
The ``--result-log`` option produces a stream of test reports which can be
82
+
analysed at runtime, but it uses a custom format which requires users to implement their own
83
+
parser.
69
84
70
-
This means that instead of :code:`MyItem(name="foo", parent=collector, obj=42)`
71
-
one now has to invoke :code:`MyItem.from_parent(collector, name="foo")`.
85
+
The `pytest-reportlog <https://github.com/pytest-dev/pytest-reportlog>`__ plugin provides a ``--report-log`` option, a more standard and extensible alternative, producing
86
+
one JSON object per-line, and should cover the same use cases. Please try it out and provide feedback.
72
87
73
-
Plugins that wish to support older versions of pytest and suppress the warning can use
74
-
`hasattr` to check if `from_parent` exists in that version:
88
+
The ``pytest-reportlog`` plugin might even be merged into the core
89
+
at some point, depending on the plans for the plugins and number of users using it.
Note that ``from_parent`` should only be called with keyword arguments for the parameters.
96
+
The ``pytest_collect_directory`` has not worked properly for years (it was called
97
+
but the results were ignored). Users may consider using :func:`pytest_collection_modifyitems <_pytest.hookspec.pytest_collection_modifyitems>` instead.
87
98
99
+
TerminalReporter.writer
100
+
~~~~~~~~~~~~~~~~~~~~~~~
88
101
102
+
.. versionremoved:: 6.0
103
+
104
+
The ``TerminalReporter.writer`` attribute has been deprecated and should no longer be used. This
105
+
was inadvertently exposed as part of the public API of that plugin and ties it too much
106
+
with ``py.io.TerminalWriter``.
107
+
108
+
Plugins that used ``TerminalReporter.writer`` directly should instead use ``TerminalReporter``
109
+
methods that provide the same functionality.
89
110
90
111
``junit_family`` default value change to "xunit2"
91
112
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
92
113
93
-
.. deprecated:: 5.2
114
+
.. versionchanged:: 6.0
94
115
95
116
The default value of ``junit_family`` option will change to ``xunit2`` in pytest 6.0, which
96
117
is an update of the old ``xunit1`` format and is supported by default in modern tools
@@ -126,55 +147,52 @@ Services known to support the ``xunit2`` format:
126
147
* `Jenkins <https://www.jenkins.io/>`__ with the `JUnit <https://plugins.jenkins.io/junit>`__ plugin.
The `pytest-reportlog <https://github.com/pytest-dev/pytest-reportlog>`__ plugin provides a ``--report-log`` option, a more standard and extensible alternative, producing
154
-
one JSON object per-line, and should cover the same use cases. Please try it out and provide feedback.
174
+
Note that ``from_parent`` should only be called with keyword arguments for the parameters.
155
175
156
-
The plan is remove the ``--result-log`` option in pytest 6.0 if ``pytest-reportlog`` proves satisfactory
157
-
to all users and is deemed stable. The ``pytest-reportlog`` plugin might even be merged into the core
158
-
at some point, depending on the plans for the plugins and number of users using it.
159
176
160
-
TerminalReporter.writer
161
-
~~~~~~~~~~~~~~~~~~~~~~~
177
+
``pytest.fixture`` arguments are keyword only
178
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
162
179
163
-
.. deprecated:: 5.4
180
+
.. versionremoved:: 6.0
164
181
165
-
The ``TerminalReporter.writer`` attribute has been deprecated and should no longer be used. This
166
-
was inadvertently exposed as part of the public API of that plugin and ties it too much
167
-
with ``py.io.TerminalWriter``.
182
+
Passing arguments to pytest.fixture() as positional arguments has been removed - pass them by keyword instead.
168
183
169
-
Plugins that used ``TerminalReporter.writer`` directly should instead use ``TerminalReporter``
170
-
methods that provide the same functionality.
184
+
``funcargnames`` alias for ``fixturenames``
185
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
171
186
187
+
.. versionremoved:: 6.0
172
188
173
-
Removed Features
174
-
----------------
189
+
The ``FixtureRequest``, ``Metafunc``, and ``Function`` classes track the names of
190
+
their associated fixtures, with the aptly-named ``fixturenames`` attribute.
175
191
176
-
As stated in our :ref:`backwards-compatibility` policy, deprecated features are removed only in major releases after
177
-
an appropriate period of deprecation has passed.
192
+
Prior to pytest 2.3, this attribute was named ``funcargnames``, and we have kept
193
+
that as an alias since. It is finally due for removal, as it is often confusing
194
+
in places where we or plugin authors must distinguish between fixture names and
195
+
names supplied by non-fixture things such as ``pytest.mark.parametrize``.
0 commit comments