diff --git a/crates/ruff/src/rules/flake8_pytest_style/rules/fixture.rs b/crates/ruff/src/rules/flake8_pytest_style/rules/fixture.rs index 60ce2d628bcd0..819b2f42e23da 100644 --- a/crates/ruff/src/rules/flake8_pytest_style/rules/fixture.rs +++ b/crates/ruff/src/rules/flake8_pytest_style/rules/fixture.rs @@ -114,6 +114,38 @@ impl Violation for PytestFixtureParamWithoutValue { } } +/// ## What it does +/// Checks for `pytest.yield_fixture` usage. +/// +/// ## Why is this bad? +/// `pytest.yield_fixture` is deprecated. `pytest.fixture` should be used instead. +/// +/// ## Example +/// ```python +/// import pytest +/// +/// +/// @pytest.yield_fixture() +/// def my_fixture(): +/// obj = SomeClass() +/// yield obj +/// obj.cleanup() +/// ``` +/// +/// Use instead: +/// ```python +/// import pytest +/// +/// +/// @pytest.fixture() +/// def my_fixture(): +/// obj = SomeClass() +/// yield obj +/// obj.cleanup() +/// ``` +/// +/// ## References +/// - [`yield_fixture` functions](https://docs.pytest.org/en/latest/yieldfixture.html) #[violation] pub struct PytestDeprecatedYieldFixture;