Skip to content

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.

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.

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.

Explicit markers and backend fixtures without two automatic modes are accepted. Runtime flags supplied only outside repository configuration cannot be evaluated reproducibly.

[tool.pytest.ini_options]
anyio_mode = "auto"
asyncio_mode = "auto"
[tool.pytest.ini_options]
anyio_mode = "auto"
asyncio_mode = "strict"