Update doc/en/deprecations.rst

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
This commit is contained in:
Thomas Grainger 2022-10-10 12:28:22 +01:00 committed by GitHub
parent 24fd292878
commit d86df89a92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 1 deletions

View File

@ -278,7 +278,18 @@ Applying a mark to a fixture function
.. deprecated:: 7.2
Applying a mark to a fixture function is deprecated. Doing so has no effect, and will raise an error in the next version.
Applying a mark to a fixture function never had any effect, but it is a common user error.
.. code-block:: python
@pytest.mark.usefixtures("clean_database")
@pytest.fixture
def user() -> User:
...
Users expected in this case that the ``usefixtures`` mark would have its intended effect of using the ``clean_database`` fixture when ``user`` was invoked, when in fact it has no effect at all.
Now pytest will issue a warning when it encounters this problem, and will raise an error in the future versions.
Backward compatibilities in ``Parser.addoption``