@@ -511,9 +511,8 @@ def _recurse(self, direntry: "os.DirEntry[str]") -> bool:
511
511
if ihook .pytest_ignore_collect (path = path , config = self .config ):
512
512
return False
513
513
norecursepatterns = self .config .getini ("norecursedirs" )
514
- for pat in norecursepatterns :
515
- if path .check (fnmatch = pat ):
516
- return False
514
+ if any (path .check (fnmatch = pat ) for pat in norecursepatterns ):
515
+ return False
517
516
return True
518
517
519
518
def _collectfile (
@@ -650,13 +649,12 @@ def collect(self) -> Iterator[Union[nodes.Item, nodes.Collector]]:
650
649
651
650
if parent .isdir ():
652
651
pkginit = parent .join ("__init__.py" )
653
- if pkginit .isfile ():
654
- if pkginit not in node_cache1 :
655
- col = self ._collectfile (pkginit , handle_dupes = False )
656
- if col :
657
- if isinstance (col [0 ], Package ):
658
- pkg_roots [str (parent )] = col [0 ]
659
- node_cache1 [col [0 ].fspath ] = [col [0 ]]
652
+ if pkginit .isfile () and pkginit not in node_cache1 :
653
+ col = self ._collectfile (pkginit , handle_dupes = False )
654
+ if col :
655
+ if isinstance (col [0 ], Package ):
656
+ pkg_roots [str (parent )] = col [0 ]
657
+ node_cache1 [col [0 ].fspath ] = [col [0 ]]
660
658
661
659
# If it's a directory argument, recurse and look for any Subpackages.
662
660
# Let the Package collector deal with subnodes, don't collect here.
0 commit comments