Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/14755.deprecation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Schedule *yield_fixture* decorator for removal in pytest 10.
2 changes: 1 addition & 1 deletion doc/en/deprecations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ The ``yield_fixture`` function/decorator

.. deprecated:: 6.2

``pytest.yield_fixture`` is a deprecated alias for :func:`pytest.fixture`.
``pytest.yield_fixture`` is a deprecated alias for :func:`pytest.fixture` and will be removed in pytest 10.
Comment thread
nicoddemus marked this conversation as resolved.

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

Expand Down
2 changes: 1 addition & 1 deletion src/_pytest/deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@


# This could have been removed pytest 8, but it's harmless and common, so no rush to remove.
YIELD_FIXTURE = PytestDeprecationWarning(
YIELD_FIXTURE = PytestRemovedIn10Warning(
"@pytest.yield_fixture is deprecated.\n"
"Use @pytest.fixture instead; they are the same."
)
Expand Down
3 changes: 2 additions & 1 deletion testing/deprecated_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from _pytest.pytester import Pytester
import pytest
from pytest import PytestDeprecationWarning
from pytest import PytestRemovedIn10Warning


@pytest.mark.parametrize("plugin", sorted(deprecated.DEPRECATED_EXTERNAL_PLUGINS))
Expand Down Expand Up @@ -66,7 +67,7 @@ def pytest_runtest_call(self):


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

@pytest.yield_fixture # type: ignore[deprecated]
def fix():
Expand Down