Skip to content

Commit

Permalink
Revert fspath deprecation
Browse files Browse the repository at this point in the history
It is not clear yet how we should proceed with this deprecation
because `pytest.Item.reportinfo` is public API and returns a `py.path` object,
and is not clear how plugins and our examples should handle that.

Reverting just the deprecation aspect of pytest-dev#8251 so we can get a 7.0.0 release out.

We will reintroduce the deprecation later once we have a clear path moving forward with replacing `reportinfo`.

Closes pytest-dev#8445
Closes pytest-dev#8821
  • Loading branch information
nicoddemus committed Jul 13, 2021
1 parent d0bd269 commit 4a9dad8
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 20 deletions.
9 changes: 0 additions & 9 deletions doc/en/deprecations.rst
Expand Up @@ -33,15 +33,6 @@ In order to support the transition to :mod:`pathlib`, the following hooks now re
The accompanying ``py.path.local`` based paths have been deprecated: plugins which manually invoke those hooks should only pass the new ``pathlib.Path`` arguments, and users should change their hook implementations to use the new ``pathlib.Path`` arguments.


``Node.fspath`` in favor of ``pathlib`` and ``Node.path``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. deprecated:: 6.3

As pytest tries to move off `py.path.local <https://py.readthedocs.io/en/latest/path.html>`__ we ported most of the node internals to :mod:`pathlib`.

Pytest will provide compatibility for quite a while.

Diamond inheritance between :class:`pytest.File` and :class:`pytest.Item`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
6 changes: 0 additions & 6 deletions src/_pytest/deprecated.py
Expand Up @@ -89,12 +89,6 @@
)


NODE_FSPATH = UnformattedWarning(
PytestDeprecationWarning,
"{type}.fspath is deprecated and will be replaced by {type}.path.\n"
"see https://docs.pytest.org/en/latest/deprecations.html#node-fspath-in-favor-of-pathlib-and-node-path",
)

HOOK_LEGACY_PATH_ARG = UnformattedWarning(
PytestDeprecationWarning,
"The ({pylib_path_arg}: py.path.local) argument is deprecated, please use ({pathlib_path_arg}: pathlib.Path)\n"
Expand Down
2 changes: 0 additions & 2 deletions src/_pytest/fixtures.py
Expand Up @@ -54,7 +54,6 @@
from _pytest.config.argparsing import Parser
from _pytest.deprecated import check_ispytest
from _pytest.deprecated import FILLFUNCARGS
from _pytest.deprecated import NODE_FSPATH
from _pytest.deprecated import YIELD_FIXTURE
from _pytest.mark import Mark
from _pytest.mark import ParameterSet
Expand Down Expand Up @@ -520,7 +519,6 @@ def module(self):
@property
def fspath(self) -> LEGACY_PATH:
"""(deprecated) The file system path of the test module which collected this test."""
warnings.warn(NODE_FSPATH.format(type=type(self).__name__), stacklevel=2)
return legacy_path(self.path)

@property
Expand Down
3 changes: 0 additions & 3 deletions src/_pytest/nodes.py
Expand Up @@ -28,7 +28,6 @@
from _pytest.config import Config
from _pytest.config import ConftestImportFailure
from _pytest.deprecated import FSCOLLECTOR_GETHOOKPROXY_ISINITPATH
from _pytest.deprecated import NODE_FSPATH
from _pytest.mark.structures import Mark
from _pytest.mark.structures import MarkDecorator
from _pytest.mark.structures import NodeKeywords
Expand Down Expand Up @@ -226,12 +225,10 @@ def __init__(
@property
def fspath(self) -> LEGACY_PATH:
"""(deprecated) returns a legacy_path copy of self.path"""
warnings.warn(NODE_FSPATH.format(type=type(self).__name__), stacklevel=2)
return legacy_path(self.path)

@fspath.setter
def fspath(self, value: LEGACY_PATH) -> None:
warnings.warn(NODE_FSPATH.format(type=type(self).__name__), stacklevel=2)
self.path = Path(value)

@classmethod
Expand Down

0 comments on commit 4a9dad8

Please sign in to comment.