Merge pull request #8446 from bluetech/unnecessary-py-path-2

More py.path removal work
This commit is contained in:
Ran Benita
2021-03-18 10:20:59 +02:00
committed by GitHub
22 changed files with 111 additions and 98 deletions

View File

@@ -778,9 +778,9 @@ class TestConftestCustomization:
import pytest
class MyModule(pytest.Module):
pass
def pytest_pycollect_makemodule(path, parent):
if path.basename == "test_xyz.py":
return MyModule.from_parent(fspath=path, parent=parent)
def pytest_pycollect_makemodule(fspath, parent):
if fspath.name == "test_xyz.py":
return MyModule.from_parent(path=fspath, parent=parent)
"""
)
pytester.makepyfile("def test_some(): pass")
@@ -882,9 +882,9 @@ class TestConftestCustomization:
return Loader()
sys.meta_path.append(Finder())
def pytest_collect_file(path, parent):
if path.ext == ".narf":
return Module.from_parent(fspath=path, parent=parent)"""
def pytest_collect_file(fspath, parent):
if fspath.suffix == ".narf":
return Module.from_parent(path=fspath, parent=parent)"""
)
pytester.makefile(
".narf",

View File

@@ -3208,10 +3208,10 @@ class TestRequestScopeAccess:
pytestmark = pytest.mark.parametrize(
("scope", "ok", "error"),
[
["session", "", "fspath class function module"],
["module", "module fspath", "cls function"],
["class", "module fspath cls", "function"],
["function", "module fspath cls function", ""],
["session", "", "path class function module"],
["module", "module path", "cls function"],
["class", "module path cls", "function"],
["function", "module path cls function", ""],
],
)