From f4a90016175f0db4d794e1600d4d47e3b9170f4d Mon Sep 17 00:00:00 2001 From: Andrew Barnes Date: Sun, 14 Jun 2026 09:10:18 -0400 Subject: [PATCH 1/2] docs: clarify confcutdir plugin discovery cutoff --- doc/en/how-to/writing_plugins.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/en/how-to/writing_plugins.rst b/doc/en/how-to/writing_plugins.rst index 56043a14f97..0b12283f991 100644 --- a/doc/en/how-to/writing_plugins.rst +++ b/doc/en/how-to/writing_plugins.rst @@ -54,8 +54,11 @@ Plugin discovery order at tool startup :confval:`testpaths` if defined and running from the rootdir, otherwise the current dir - for each test path, load ``conftest.py`` and ``test*/conftest.py`` relative - to the directory part of the test path, if exist. Before a ``conftest.py`` - file is loaded, load ``conftest.py`` files in all of its parent directories. + to the directory part of the test path, if they exist. Before a ``conftest.py`` + file is loaded, load ``conftest.py`` files in its parent directories up to + the :option:`--confcutdir` limit. When ``--confcutdir`` is not provided, + the cutoff defaults to the directory containing the config file, or to the + :ref:`rootdir ` if no config file is found. After a ``conftest.py`` file is loaded, recursively load all plugins specified in its :globalvar:`pytest_plugins` variable if present. From bfc86c40f71967e535da8f6b8e25ade45eb74c8a Mon Sep 17 00:00:00 2001 From: Andrew Barnes Date: Sat, 20 Jun 2026 12:43:47 -0400 Subject: [PATCH 2/2] docs: add confcutdir changelog fragment --- changelog/12857.doc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/12857.doc.rst diff --git a/changelog/12857.doc.rst b/changelog/12857.doc.rst new file mode 100644 index 00000000000..08b2af97277 --- /dev/null +++ b/changelog/12857.doc.rst @@ -0,0 +1 @@ +Documented how ``--confcutdir`` affects initial ``conftest.py`` discovery.