Add `PT024` documentation (#6026)

This commit is contained in:
Harutaka Kawamura 2023-07-27 02:48:37 +09:00 committed by GitHub
parent 13f9a16e33
commit 5b8fc753ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 0 deletions

View File

@ -197,6 +197,29 @@ impl AlwaysAutofixableViolation for PytestErroneousUseFixturesOnFixture {
} }
} }
/// ## What it does
/// Checks for unnecessary `@pytest.mark.asyncio` decorators applied to fixtures.
///
/// ## Why is this bad?
/// `pytest.mark.asyncio` is unnecessary for fixtures.
///
/// ## Example
/// ```python
/// @pytest.mark.asyncio()
/// @pytest.fixture()
/// async def my_fixture():
/// return 0
/// ```
///
/// Use instead:
/// ```python
/// @pytest.fixture()
/// async def my_fixture():
/// return 0
/// ```
///
/// ## References
/// - [`pytest-asyncio`](https://pypi.org/project/pytest-asyncio/)
#[violation] #[violation]
pub struct PytestUnnecessaryAsyncioMarkOnFixture; pub struct PytestUnnecessaryAsyncioMarkOnFixture;