diff --git a/changelog/7422.doc.rst b/changelog/7422.doc.rst new file mode 100644 index 00000000000..105fb4be630 --- /dev/null +++ b/changelog/7422.doc.rst @@ -0,0 +1 @@ +Clarified when the ``usefixtures`` mark can apply fixtures to test. diff --git a/doc/en/reference.rst b/doc/en/reference.rst index 005014d84d4..828a2af2776 100644 --- a/doc/en/reference.rst +++ b/doc/en/reference.rst @@ -180,15 +180,18 @@ pytest.mark.usefixtures Mark a test function as using the given fixture names. -.. warning:: - - This mark has no effect when applied - to a **fixture** function. - .. py:function:: pytest.mark.usefixtures(*names) :param args: the names of the fixture to use, as strings +.. note:: + + When using `usefixtures` in hooks, it can only load fixtures when applied to a test function before test setup + (for example in the `pytest_collection_modifyitems` hook). + + Also not that his mark has no effect when applied to **fixtures**. + + .. _`pytest.mark.xfail ref`: