diff --git a/doc/en/reference.rst b/doc/en/reference.rst index 667547894..6e94d4c49 100644 --- a/doc/en/reference.rst +++ b/doc/en/reference.rst @@ -688,6 +688,10 @@ items, delete or otherwise amend the test items: .. autofunction:: pytest_collection_modifyitems +.. note:: + If this hook is implemented in ``conftest.py`` files, it always receives all collected items, not only those + under the ``conftest.py`` where it is implemented. + .. autofunction:: pytest_collection_finish Test running (runtest) hooks diff --git a/doc/en/writing_plugins.rst b/doc/en/writing_plugins.rst index 0492b5fcf..41967525b 100644 --- a/doc/en/writing_plugins.rst +++ b/doc/en/writing_plugins.rst @@ -107,6 +107,10 @@ Here is how you might run it:: See also: :ref:`pythonpath`. +.. note:: + Some hooks should be implemented only in plugins or conftest.py files situated at the + tests root directory due to how pytest discovers plugins during startup, + see the documentation of each hook for details. Writing your own plugin -----------------------