nodes: deprecate fspath arguments to node constructors

This is unfortunately a dependency on `py.path` which cannot be moved to
an external plugins or eased in any way, so has to be deprecated in
order for pytest to be able to eventually remove the dependency on `py`.
This commit is contained in:
Ran Benita
2021-10-23 22:05:56 +03:00
parent 99363ad7ff
commit 7706fd6840
6 changed files with 58 additions and 4 deletions

View File

@@ -215,3 +215,16 @@ def test_deprecation_of_cmdline_preparse(pytester: Pytester) -> None:
"*Please use pytest_load_initial_conftests hook instead.*",
]
)
def test_node_ctor_fspath_argument_is_deprecated(pytester: Pytester) -> None:
mod = pytester.getmodulecol("")
with pytest.warns(
pytest.PytestDeprecationWarning,
match=re.escape("The (fspath: py.path.local) argument to File is deprecated."),
):
pytest.File.from_parent(
parent=mod.parent,
fspath=legacy_path("bla"),
)