Revert fspath deprecation
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 #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 #8445 Closes #8821
This commit is contained in:
@@ -89,12 +89,6 @@ ARGUMENT_TYPE_STR = UnformattedWarning(
|
||||
)
|
||||
|
||||
|
||||
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"
|
||||
|
||||
@@ -54,7 +54,6 @@ from _pytest.config import Config
|
||||
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
|
||||
@@ -520,7 +519,6 @@ class FixtureRequest:
|
||||
@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
|
||||
|
||||
@@ -28,7 +28,6 @@ from _pytest.compat import legacy_path
|
||||
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
|
||||
@@ -226,12 +225,10 @@ class Node(metaclass=NodeMeta):
|
||||
@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
|
||||
|
||||
Reference in New Issue
Block a user