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. 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.