A pytest plugin that runs all async tests cooperatively using a single event loop, avoiding event loop conflicts and improving performance. Current version: 0.40.0, requires Python >=3.8. Released under MIT license; maintenance cadence is irregular.
pip install pytest-asyncio-cooperativeVerified import paths — ran on the pinned version, not inferred.
Basic setup: define a session-scoped event_loop fixture (if not using async fixtures) and mark tests with @pytest.mark.asyncio_cooperative.
Use @pytest.mark.asyncio_cooperative instead of @pytest.mark.asyncio.
Define a session-scoped event_loop fixture in conftest.py that creates a new event loop.
Ensure all async tests within the session use the same event loop; do not create new loops manually.