Clarify usage of usefixtures mark in hooks
Fix #7512 Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
This commit is contained in:
parent
6ecb8f53d0
commit
dbc50a7061
|
@ -0,0 +1 @@
|
|||
Clarified when the ``usefixtures`` mark can apply fixtures to test.
|
|
@ -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`:
|
||||
|
||||
|
|
Loading…
Reference in New Issue