From 7e94733b21fe8290cb97ded035cb5eaade168ba1 Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Sun, 5 Apr 2026 09:05:53 +0200 Subject: [PATCH] docs: document private pytest API usage in conftest --- conftest.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conftest.py b/conftest.py index fd668a6..0ca627b 100644 --- a/conftest.py +++ b/conftest.py @@ -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,