PY-TEST0006 · async_runner_auto_mode_conflict
Detect conflicting AnyIO and pytest-asyncio automatic modes.
This is a deterministic rule for python. Read its implementation.
Definition
Section titled “Definition”Read the effective pytest configuration and return true only when both AnyIO’s anyio_mode
and pytest-asyncio’s asyncio_mode equal auto. AnyIO documents this exact combination as a
plugin conflict. The check is deliberately narrower than generic async-test style rules and
does not infer a conflict from installed dependencies alone.
Evidence
Section titled “Evidence”The finding identifies the effective pytest configuration file and both normalized option values. The suggested resolution keeps AnyIO automatic mode while restoring pytest-asyncio’s documented strict default, though projects can make the inverse ownership choice.
Exceptions
Section titled “Exceptions”Explicit markers and backend fixtures without two automatic modes are accepted. Runtime flags supplied only outside repository configuration cannot be evaluated reproducibly.
Examples
Section titled “Examples”[tool.pytest.ini_options]anyio_mode = "auto"asyncio_mode = "auto"[tool.pytest.ini_options]anyio_mode = "auto"asyncio_mode = "strict"References
Section titled “References”- Cites “AnyIO documentation”, testing guide. Open reference
- Cites “pytest-asyncio documentation”, configuration. Open reference
- Cites “pytest-asyncio documentation”, concepts. Open reference