File tree Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -376,6 +376,9 @@ def _in_venv(path: Path) -> bool:
376376
377377
378378def pytest_ignore_collect (collection_path : Path , config : Config ) -> Optional [bool ]:
379+ if collection_path .name == "__pycache__" :
380+ return True
381+
379382 ignore_paths = config ._getconftest_pathlist (
380383 "collect_ignore" , path = collection_path .parent
381384 )
@@ -505,8 +508,6 @@ def collect(self) -> Iterable[Union[nodes.Item, nodes.Collector]]:
505508 ihook = self .ihook
506509 for direntry in scandir (self .path ):
507510 if direntry .is_dir ():
508- if direntry .name == "__pycache__" :
509- continue
510511 path = Path (direntry .path )
511512 if not self .session .isinitpath (path , with_parents = True ):
512513 if ihook .pytest_ignore_collect (collection_path = path , config = config ):
Original file line number Diff line number Diff line change @@ -707,8 +707,6 @@ def sort_key(entry: "os.DirEntry[str]") -> object:
707707 ihook = self .ihook
708708 for direntry in scandir (self .path , sort_key ):
709709 if direntry .is_dir ():
710- if direntry .name == "__pycache__" :
711- continue
712710 path = Path (direntry .path )
713711 if not self .session .isinitpath (path , with_parents = True ):
714712 if ihook .pytest_ignore_collect (collection_path = path , config = config ):
You can’t perform that action at this time.
0 commit comments