@@ -183,46 +183,6 @@ In ``9.0``, the warning will turn into an error, and in ``9.1`` :func:`pytest.im
183183:class: `ImportError ` by passing it to ``exc_type ``.
184184
185185
186- .. _node-ctor-fspath-deprecation :
187-
188- ``fspath `` argument for Node constructors replaced with ``pathlib.Path ``
189- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
190-
191- .. deprecated :: 7.0
192-
193- In order to support the transition from ``py.path.local `` to :mod: `pathlib `,
194- the ``fspath `` argument to :class: `~_pytest.nodes.Node ` constructors like
195- :func: `pytest.Function.from_parent() ` and :func: `pytest.Class.from_parent() `
196- is now deprecated.
197-
198- Plugins which construct nodes should pass the ``path `` argument, of type
199- :class: `pathlib.Path `, instead of the ``fspath `` argument.
200-
201- Plugins which implement custom items and collectors are encouraged to replace
202- ``fspath `` parameters (``py.path.local ``) with ``path `` parameters
203- (``pathlib.Path ``), and drop any other usage of the ``py `` library if possible.
204-
205- If possible, plugins with custom items should use :ref: `cooperative
206- constructors <uncooperative-constructors-deprecated>` to avoid hardcoding
207- arguments they only pass on to the superclass.
208-
209- .. note ::
210- The name of the :class: `~_pytest.nodes.Node ` arguments and attributes (the
211- new attribute being ``path ``) is **the opposite ** of the situation for
212- hooks, :ref: `outlined below <legacy-path-hooks-deprecated >` (the old
213- argument being ``path ``).
214-
215- This is an unfortunate artifact due to historical reasons, which should be
216- resolved in future versions as we slowly get rid of the :pypi: `py `
217- dependency (see :issue: `9283 ` for a longer discussion).
218-
219- Due to the ongoing migration of methods like :meth: `~pytest.Item.reportinfo `
220- which still is expected to return a ``py.path.local `` object, nodes still have
221- both ``fspath `` (``py.path.local ``) and ``path `` (``pathlib.Path ``) attributes,
222- no matter what argument was used in the constructor. We expect to deprecate the
223- ``fspath `` attribute in a future release.
224-
225-
226186Configuring hook specs/impls using markers
227187~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
228188
@@ -353,6 +313,48 @@ an appropriate period of deprecation has passed.
353313
354314Some breaking changes which could not be deprecated are also listed.
355315
316+
317+ .. _node-ctor-fspath-deprecation :
318+
319+ ``fspath `` argument for Node constructors replaced with ``pathlib.Path ``
320+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
321+
322+ .. deprecated :: 7.0
323+ .. versionremoved :: 9.1
324+
325+ In order to support the transition from ``py.path.local `` to :mod: `pathlib `,
326+ the ``fspath `` argument to :class: `~_pytest.nodes.Node ` constructors like
327+ :func: `pytest.Function.from_parent() ` and :func: `pytest.Class.from_parent() `
328+ is now deprecated.
329+
330+ Plugins which construct nodes should pass the ``path `` argument, of type
331+ :class: `pathlib.Path `, instead of the ``fspath `` argument.
332+
333+ Plugins which implement custom items and collectors are encouraged to replace
334+ ``fspath `` parameters (``py.path.local ``) with ``path `` parameters
335+ (``pathlib.Path ``), and drop any other usage of the ``py `` library if possible.
336+
337+ If possible, plugins with custom items should use :ref: `cooperative
338+ constructors <uncooperative-constructors-deprecated>` to avoid hardcoding
339+ arguments they only pass on to the superclass.
340+
341+ .. note ::
342+ The name of the :class: `~_pytest.nodes.Node ` arguments and attributes (the
343+ new attribute being ``path ``) is **the opposite ** of the situation for
344+ hooks, :ref: `outlined below <legacy-path-hooks-deprecated >` (the old
345+ argument being ``path ``).
346+
347+ This is an unfortunate artifact due to historical reasons, which should be
348+ resolved in future versions as we slowly get rid of the :pypi: `py `
349+ dependency (see :issue: `9283 ` for a longer discussion).
350+
351+ Due to the ongoing migration of methods like :meth: `~pytest.Item.reportinfo `
352+ which still is expected to return a ``py.path.local `` object, nodes still have
353+ both ``fspath `` (``py.path.local ``) and ``path `` (``pathlib.Path ``) attributes,
354+ no matter what argument was used in the constructor. We expect to deprecate the
355+ ``fspath `` attribute in a future release.
356+
357+
356358.. _sync-test-async-fixture :
357359
358360sync test depending on async fixture
0 commit comments