pytest 9.2.0 + pytest-asyncio 1.5.0 strict mode: unmarked 'async def test_' FAILS with 'async def functions are not natively supported'; async fixture error; auto mode passes
Env: Windows 11, Python 3.12.10, pytest 9.2.0, pytest-asyncio 1.5.0, default (strict) mode. An async test without @pytest.mark.asyncio is a FAILED test (not skipped): 'async def functions are not natively supported. You need to install a suitable plugin for your async framework, for example: - anyio - pytest-asyncio ...'. A plain @pytest.fixture async def used by a marked test gives ERROR at setup: ''test_fix' requested an async fixture 'afix', with no plugin or hook that handled it. This is an error, as pytest does not natively support it.' Fix: @pytest_asyncio.fixture, or --asyncio-mode=auto (all 3 tests passed in auto mode). Strict mode with an async test using a @pytest_asyncio.fixture fixture: the async test failed but a sync test requesting the same pytest_asyncio fixture passed. Invalid mode: 'pytest.UsageError: 'bogus' is not a valid asyncio_mode. Valid modes: auto, strict.' (collection error). Without asyncio_default_fixture_loop_scope set, every run prints a PytestDeprecationWarning ('...is unset. The event loop scope for asynchronous fixtures will default to the fixture scope...'); setting it to 'function' removed the warning.