PT024

March 13, 2021 ยท View on GitHub

pytest.mark.asyncio is unnecessary for fixtures

Examples

Bad code:

import pytest

@pytest.mark.asyncio()
@pytest.fixture()
async def my_fixture():
    return 0

Good code:

import pytest

@pytest.fixture()
async def my_fixture():
    return 0

Rationale

  • the mark is useless on fixtures and therefore unnecessary