@@ -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 (
@@ -636,13 +635,12 @@ def collect(self) -> Iterator[Union[nodes.Item, nodes.Collector]]:
636
635
637
636
if parent .isdir ():
638
637
pkginit = parent .join ("__init__.py" )
639
- if pkginit .isfile ():
640
- if pkginit not in node_cache1 :
641
- col = self ._collectfile (pkginit , handle_dupes = False )
642
- if col :
643
- if isinstance (col [0 ], Package ):
644
- pkg_roots [str (parent )] = col [0 ]
645
- node_cache1 [col [0 ].fspath ] = [col [0 ]]
638
+ if pkginit .isfile () and pkginit not in node_cache1 :
639
+ col = self ._collectfile (pkginit , handle_dupes = False )
640
+ if col :
641
+ if isinstance (col [0 ], Package ):
642
+ pkg_roots [str (parent )] = col [0 ]
643
+ node_cache1 [col [0 ].fspath ] = [col [0 ]]
646
644
647
645
# If it's a directory argument, recurse and look for any Subpackages.
648
646
# Let the Package collector deal with subnodes, don't collect here.
0 commit comments