From 991bc7bd50772b0ae1f40b5f821f7e67745d1b2e Mon Sep 17 00:00:00 2001 From: Nimesh Vashistha <43320077+nimeshvashistha@users.noreply.github.com> Date: Sat, 17 Oct 2020 16:56:30 +0530 Subject: [PATCH] Added note to writing_plugins.rst (#7896) Co-authored-by: Bruno Oliveira --- doc/en/reference.rst | 4 ++++ doc/en/writing_plugins.rst | 4 ++++ 2 files changed, 8 insertions(+) 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 -----------------------