@@ -188,19 +188,15 @@ def pytest_pyfunc_call(pyfuncitem: "Function") -> Optional[object]:
188
188
return True
189
189
190
190
191
- def pytest_collect_file (
192
- fspath : Path , path : LEGACY_PATH , parent : nodes .Collector
193
- ) -> Optional ["Module" ]:
191
+ def pytest_collect_file (fspath : Path , parent : nodes .Collector ) -> Optional ["Module" ]:
194
192
if fspath .suffix == ".py" :
195
193
if not parent .session .isinitpath (fspath ):
196
194
if not path_matches_patterns (
197
195
fspath , parent .config .getini ("python_files" ) + ["__init__.py" ]
198
196
):
199
197
return None
200
198
ihook = parent .session .gethookproxy (fspath )
201
- module : Module = ihook .pytest_pycollect_makemodule (
202
- fspath = fspath , path = path , parent = parent
203
- )
199
+ module : Module = ihook .pytest_pycollect_makemodule (fspath = fspath , parent = parent )
204
200
return module
205
201
return None
206
202
@@ -675,9 +671,8 @@ def _recurse(self, direntry: "os.DirEntry[str]") -> bool:
675
671
if direntry .name == "__pycache__" :
676
672
return False
677
673
fspath = Path (direntry .path )
678
- path = legacy_path (fspath )
679
674
ihook = self .session .gethookproxy (fspath .parent )
680
- if ihook .pytest_ignore_collect (fspath = fspath , path = path , config = self .config ):
675
+ if ihook .pytest_ignore_collect (fspath = fspath , config = self .config ):
681
676
return False
682
677
norecursepatterns = self .config .getini ("norecursedirs" )
683
678
if any (fnmatch_ex (pat , fspath ) for pat in norecursepatterns ):
@@ -687,17 +682,14 @@ def _recurse(self, direntry: "os.DirEntry[str]") -> bool:
687
682
def _collectfile (
688
683
self , fspath : Path , handle_dupes : bool = True
689
684
) -> Sequence [nodes .Collector ]:
690
- path = legacy_path (fspath )
691
685
assert (
692
686
fspath .is_file ()
693
687
), "{!r} is not a file (isdir={!r}, exists={!r}, islink={!r})" .format (
694
688
fspath , fspath .is_dir (), fspath .exists (), fspath .is_symlink ()
695
689
)
696
690
ihook = self .session .gethookproxy (fspath )
697
691
if not self .session .isinitpath (fspath ):
698
- if ihook .pytest_ignore_collect (
699
- fspath = fspath , path = path , config = self .config
700
- ):
692
+ if ihook .pytest_ignore_collect (fspath = fspath , config = self .config ):
701
693
return ()
702
694
703
695
if handle_dupes :
@@ -709,7 +701,7 @@ def _collectfile(
709
701
else :
710
702
duplicate_paths .add (fspath )
711
703
712
- return ihook .pytest_collect_file (fspath = fspath , path = path , parent = self ) # type: ignore[no-any-return]
704
+ return ihook .pytest_collect_file (fspath = fspath , parent = self ) # type: ignore[no-any-return]
713
705
714
706
def collect (self ) -> Iterable [Union [nodes .Item , nodes .Collector ]]:
715
707
this_path = self .path .parent
0 commit comments