Merge pull request #8463 from RonnyPfannschmidt/workaround-8361
address #8361 - introduce hook caller wrappers that enable backward compat
This commit is contained in:
@@ -555,7 +555,9 @@ class Session(nodes.FSCollector):
|
||||
remove_mods = pm._conftest_plugins.difference(my_conftestmodules)
|
||||
if remove_mods:
|
||||
# One or more conftests are not in use at this fspath.
|
||||
proxy = FSHookProxy(pm, remove_mods)
|
||||
from .config.compat import PathAwareHookProxy
|
||||
|
||||
proxy = PathAwareHookProxy(FSHookProxy(pm, remove_mods))
|
||||
else:
|
||||
# All plugins are active for this fspath.
|
||||
proxy = self.config.hook
|
||||
@@ -565,9 +567,8 @@ class Session(nodes.FSCollector):
|
||||
if direntry.name == "__pycache__":
|
||||
return False
|
||||
fspath = Path(direntry.path)
|
||||
path = legacy_path(fspath)
|
||||
ihook = self.gethookproxy(fspath.parent)
|
||||
if ihook.pytest_ignore_collect(fspath=fspath, path=path, config=self.config):
|
||||
if ihook.pytest_ignore_collect(fspath=fspath, config=self.config):
|
||||
return False
|
||||
norecursepatterns = self.config.getini("norecursedirs")
|
||||
if any(fnmatch_ex(pat, fspath) for pat in norecursepatterns):
|
||||
@@ -577,7 +578,6 @@ class Session(nodes.FSCollector):
|
||||
def _collectfile(
|
||||
self, fspath: Path, handle_dupes: bool = True
|
||||
) -> Sequence[nodes.Collector]:
|
||||
path = legacy_path(fspath)
|
||||
assert (
|
||||
fspath.is_file()
|
||||
), "{!r} is not a file (isdir={!r}, exists={!r}, islink={!r})".format(
|
||||
@@ -585,9 +585,7 @@ class Session(nodes.FSCollector):
|
||||
)
|
||||
ihook = self.gethookproxy(fspath)
|
||||
if not self.isinitpath(fspath):
|
||||
if ihook.pytest_ignore_collect(
|
||||
fspath=fspath, path=path, config=self.config
|
||||
):
|
||||
if ihook.pytest_ignore_collect(fspath=fspath, config=self.config):
|
||||
return ()
|
||||
|
||||
if handle_dupes:
|
||||
@@ -599,7 +597,7 @@ class Session(nodes.FSCollector):
|
||||
else:
|
||||
duplicate_paths.add(fspath)
|
||||
|
||||
return ihook.pytest_collect_file(fspath=fspath, path=path, parent=self) # type: ignore[no-any-return]
|
||||
return ihook.pytest_collect_file(fspath=fspath, parent=self) # type: ignore[no-any-return]
|
||||
|
||||
@overload
|
||||
def perform_collect(
|
||||
|
||||
Reference in New Issue
Block a user