PY-TEST0010 · unowned_async_test_count
Count async pytest tests without AnyIO or pytest-asyncio ownership.
This is a deterministic rule for python. Read its implementation.
Definition
Section titled “Definition”Inspect async functions and methods collected through pytest’s default Python conventions.
Accept a test when its function, class, or module carries pytest.mark.anyio or
pytest.mark.asyncio. Also accept direct and transitive requests for AnyIO’s anyio_backend
fixture. Set discovery to "automatic" when an async plugin automatically owns every async
test in repository configuration.
Evidence
Section titled “Evidence”Each finding identifies one async test for which no supported runner contract is visible. Fixture ownership follows statically declared fixture dependencies to a fixed point. Dynamic plugin hooks are not guessed. The value is the number of async tests with no visible runner contract.
Exceptions
Section titled “Exceptions”A project with a custom async collector can exclude its paths. Strict pytest-asyncio mode
requires an asyncio marker. AnyIO accepts its marker, automatic mode, or a direct or indirect
anyio_backend request. Ruff PT rules do not prove async-plugin ownership.
Examples
Section titled “Examples”async def test_fetch(): assert (await fetch()).status == 200pytestmark = pytest.mark.anyio
async def test_fetch(): assert (await fetch()).status == 200References
Section titled “References”- Cites “AnyIO documentation”, asynchronous test ownership. Open reference
- Cites “pytest-asyncio documentation”, strict and auto discovery. Open reference
- Cites “pytest documentation”, default collection conventions. Open reference