docs: document private pytest API usage in conftest

This commit is contained in:
2026-04-05 09:05:53 +02:00
parent 11beba1c47
commit 7e94733b21
+3
View File
@@ -20,6 +20,9 @@ class _RootDirPlugin:
"""Registered as a plugin so it intercepts hooks before conftest scope limits."""
def pytest_collect_directory(self, path, parent):
# NOTE: _pytest.main.Dir is a private pytest internal (tested against pytest 8.x/9.x).
# If collection breaks after a pytest upgrade, check if Dir moved or was renamed.
# Alternative: add collect_ignore=["__init__.py"] at top of this file.
from _pytest.main import Dir
if Path(path) == Path(_root):
# Return a plain Dir node instead of a Package node for the root,