mirror of https://github.com/astral-sh/ruff
Add `PT020` doc (#6011)
This commit is contained in:
parent
5dbb4dd823
commit
95e6258d5d
|
|
@ -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]
|
#[violation]
|
||||||
pub struct PytestDeprecatedYieldFixture;
|
pub struct PytestDeprecatedYieldFixture;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue