diff --git a/pytest_asyncio/plugin.py b/pytest_asyncio/plugin.py index 32b1a834..a15dac0f 100644 --- a/pytest_asyncio/plugin.py +++ b/pytest_asyncio/plugin.py @@ -281,6 +281,7 @@ def _validate_scope(scope: str | None, option_name: str) -> None: def pytest_configure(config: Config) -> None: + _get_asyncio_mode(config) default_fixture_loop_scope = config.getini("asyncio_default_fixture_loop_scope") if default_fixture_loop_scope != _MATCH_FIXTURE_SCOPE: _validate_scope( diff --git a/tests/test_simple.py b/tests/test_simple.py index 8ddeade3..22b07f17 100644 --- a/tests/test_simple.py +++ b/tests/test_simple.py @@ -99,3 +99,14 @@ def test_invalid_asyncio_mode(pytester): result.stderr.fnmatch_lines( "ERROR: 'True' is not a valid asyncio_mode. Valid modes: auto, strict." ) + + +def test_invalid_asyncio_mode_quiet(pytester): + pytester.makeini("[pytest]\nasyncio_default_fixture_loop_scope = function") + pytester.makepyfile("def test_sync(): pass") + result = pytester.runpytest("-q", "-o", "asyncio_mode=bogus") + assert result.ret == pytest.ExitCode.USAGE_ERROR + result.stderr.no_fnmatch_line("INTERNALERROR> *") + result.stderr.fnmatch_lines( + "ERROR: 'bogus' is not a valid asyncio_mode. Valid modes: auto, strict." + )