Currently the two recursive collectors Session and Package perform the norecursedir check directly in the collector:
|
norecursepatterns = self.config.getini("norecursedirs") |
|
if any(fnmatch_ex(pat, fspath) for pat in norecursepatterns): |
|
return False |
|
norecursepatterns = self.config.getini("norecursedirs") |
|
if any(fnmatch_ex(pat, fspath) for pat in norecursepatterns): |
|
return False |
I think it would be strictly better to move this check to main's pytest_ignore_collect hookimpl:
- Less duplication
- Better decoupling -- only main knows about the option it defines
- More control for plugins
Currently the two recursive collectors
SessionandPackageperform thenorecursedircheck directly in the collector:pytest/src/_pytest/main.py
Lines 566 to 568 in 85c5bd2
pytest/src/_pytest/python.py
Lines 709 to 711 in 85c5bd2
I think it would be strictly better to move this check to
main'spytest_ignore_collecthookimpl: