pytest-dev/pytest-asyncio
Last release: 2026-05-26
pytest-asyncio is an extension for pytest that adds support for writing and running asynchronous tests. It’s useful when you need to test async code (for example, coroutines) using pytest’s test runner.
Project status
- Actively maintained, with a very recent upstream push on 2026-05-26 and a sequence of alpha updates followed quickly by a stable update (1.4.0a0 on 2026-04-15, 1.4.0a1 on 2026-04-15, 1.4.0a2 on 2026-05-15, and 1.4.0 on 2026-05-26).
- Update cadence appears fast during the 1.4.0 cycle, roughly every 2-6 weeks in recent months, and then within about two weeks between the last alpha (1.4.0a2) and the stable release (1.4.0).
AI summary generated 2026-05-28
Recent updates
v1.4.0
2026-05-26pytest-asyncio v1.4.0 introduces the new pytest_asyncio_loop_factories hook to parameterize asyncio tests with per-test custom event loop factories, and deprecates overriding the event_loop_policy fixture. The release also updates documentation and warning behavior, bumps the minimum supported pytest version to 8.4.0, and fixes a ResourceWarning about unclosed event loops in certain synchronous-test scenarios.
Featuresv1.4.0a2
2026-05-15pytest-asyncio 1.4.0a2 adds the new pytest_asyncio_loop_factories hook, deprecates overriding event_loop_policy, and improves event loop cleanup after async tests and fixtures. It also raises the minimum supported pytest version to 8.4.0 and refreshes several documentation and development dependencies.
BreakingFeaturesv1.4.0a1
2026-04-15This alpha release adds the new `pytest_asyncio_loop_factories` hook and `loop_factories` marker support for running async tests against custom event loop factories. It also fixes event-loop handling for synchronous `@pytest_asyncio.fixture` fixtures, raises the minimum supported pytest version to 8.4.0, and refreshes the docs build tooling.
BreakingFeaturesv1.4.0a0
2026-04-15This alpha release adds a new `pytest_asyncio_loop_factories` hook so async tests can run against custom event loop factories, plus per-test selection via `pytest.mark.asyncio(loop_factories=[...])`. It also refreshes the warning text for unset `asyncio_default_fixture_loop_scope` and updates docs and development tooling.
Featuresv1.3.0
2025-11-10pytest-asyncio 1.3.0 drops Python 3.9, adds compatibility for pytest 9, and refreshes CI and test infrastructure for Python 3.14 and free-threaded 3.14t. The runtime package changes are very small, mostly packaging metadata and typing cleanup, so the visible API surface appears stable aside from the documented platform support changes.
BreakingFeaturesv1.2.0
2025-09-12pytest-asyncio 1.2.0 adds an asyncio debug option, validates bad loop-scope config earlier, and improves Pyright compatibility. It also fixes a main-thread event loop reset bug, updates a strict-mode warning message, and refreshes packaging and CI infrastructure.
BreakingFeaturesv1.1.1
2025-09-12pytest-asyncio 1.1.1 is a packaging focused release. The published notes only mention a build fix for downstream packagers using setuptools-scm 9 or newer, and the code changes support that by removing the invalid setuptools-scm setup and switching version handling to runtime metadata lookup.
v1.1.0
2025-07-16pytest-asyncio 1.1.0 adds ContextVars propagation from async fixtures on Python 3.10 and older, task cancellation when loop_scope ends, and a warning when a test closes the current event loop. It also fixes missing-loop errors in task finalizers, removes duplicate warning emissions, and adds a runtime dependency on backports.asyncio.runner for older Python versions.
Featuresv1.1.0a1
2025-06-30pytest-asyncio 1.1.0a1 adds ContextVar propagation for older Python versions, cancels tasks when an async fixture loop scope ends, and warns when a test closes the current event loop. The release also introduces a runtime dependency on backports.asyncio.runner for Python 3.10 and earlier, while the codebase refactors async fixture execution and updates release automation.
Featuresv1.0.0
2025-05-26pytest-asyncio 1.0.0 removes the deprecated event_loop fixture, adds preliminary Python 3.14 support, and changes scoped loop lifecycle semantics so loops are created once per scope. It also fixes several pytest integration issues, including setup-plan, doctest import error handling, and package-scoped loops.
BreakingFeaturesv1.0.0a1
2025-05-09pytest-asyncio 1.0.0a1 is a major alpha that removes the deprecated event_loop fixture, adds preliminary Python 3.14 support, and refactors scoped loop handling. It also changes loop_scope behavior so scoped loops are created once per scope and no longer require a collector at the requested scope.
BreakingFeaturesv0.26.0
2025-03-25pytest-asyncio v0.26.0 adds a new configuration option to set a default event loop scope for all async tests. It also improves type annotations for `pytest_asyncio.fixture` and adds `typing-extensions` for Python versions below 3.10.
Features