Skip to content

Commit d7f6190

Browse files
Merge pull request #14755 from seifertm/yield_fixture_removal
Slate yield_fixture decorator for removal in pytest 10
2 parents 9775753 + 47bf797 commit d7f6190

4 files changed

Lines changed: 5 additions & 3 deletions

File tree

‎changelog/14755.deprecation.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Schedule *yield_fixture* decorator for removal in pytest 10.

‎doc/en/deprecations.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ The ``yield_fixture`` function/decorator
440440

441441
.. deprecated:: 6.2
442442

443-
``pytest.yield_fixture`` is a deprecated alias for :func:`pytest.fixture`.
443+
``pytest.yield_fixture`` is a deprecated alias for :func:`pytest.fixture` and will be removed in pytest 10.
444444

445445
It has been so for a very long time, so it can be searched/replaced safely.
446446

‎src/_pytest/deprecated.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030

3131
# This could have been removed pytest 8, but it's harmless and common, so no rush to remove.
32-
YIELD_FIXTURE = PytestDeprecationWarning(
32+
YIELD_FIXTURE = PytestRemovedIn10Warning(
3333
"@pytest.yield_fixture is deprecated.\n"
3434
"Use @pytest.fixture instead; they are the same."
3535
)

‎testing/deprecated_test.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from _pytest.scope import Scope
77
import pytest
88
from pytest import PytestDeprecationWarning
9+
from pytest import PytestRemovedIn10Warning
910

1011

1112
@pytest.mark.parametrize("plugin", sorted(deprecated.DEPRECATED_EXTERNAL_PLUGINS))
@@ -75,7 +76,7 @@ def pytest_runtest_call(self):
7576

7677

7778
def test_yield_fixture_is_deprecated() -> None:
78-
with pytest.warns(DeprecationWarning, match=r"yield_fixture is deprecated"):
79+
with pytest.warns(PytestRemovedIn10Warning, match=r"yield_fixture is deprecated"):
7980

8081
@pytest.yield_fixture # type: ignore[deprecated]
8182
def fix():

0 commit comments

Comments
 (0)