You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Invalid asyncio_mode is only validated when the report header is printed #1633
🤖 Written by Claude Opus 5.5 via Claude Code for the pytest-asyncio maintainers; I prompted it, it did the work, I read it.
asyncio_mode is checked by _get_asyncio_mode(), which runs first from pytest_report_header. With -q there is no header, so a bad value is not reported at configuration time:
$ pytest -o asyncio_mode=bogus # header printed
ERROR: 'bogus' is not a valid asyncio_mode. Valid modes: auto, strict.
$ pytest -q -o asyncio_mode=bogus test_sync.py # only sync tests
1 passed # silently accepted
$ pytest -q -o asyncio_mode=bogus test_async.py # async test present
ERROR test_async.py - pytest.UsageError: 'bogus' is not a valid asyncio_mode...
Interrupted: 1 error during collection # traceback, exit 2
asyncio_default_fixture_loop_scope is already validated in pytest_configure. Calling _get_asyncio_mode(config) there too would give the same single usage error (exit 4) in all three cases.
Seen on main (599fb32). Spotted while reviewing #1632, which proposes that change but comes from an account that has been banned from pytest-dev.
Activity