Repository navigation
Releases
pytest-asyncio v2.0.0a1
2.0.0a1 - 2026-11-13
Removed
- Deprecated scope keyword argument of the asyncio marker. Use loop_scope instead. (#1475)
- Deprecated event_loop_policy fixture (#1517)
- Support for Python 3.10 (#1618)
Added
- Preliminary support for Python 3.16 (#1593)
Changed
- Breaking change: using
@pytest.fixtureon async fixtures in strict mode raisespytest.UsageErrorinstead ofPytestDeprecationWarning(#1202) - Disable asyncio policy restoration between tests on Python 3.16 and newer, since the policy system was removed in Python 3.16 (#1593)
- The return type of
pytest_asyncio.is_async_testis nowbool, so type checkers no longer narrow the item topytest.Function. (#1598)
Fixed
- Arguments to asyncio marks applied with
pytest.paramare validated like those of other asyncio marks. (#1475) - Fixed cancelled async fixture setup and teardown being propagated as
asyncio.CancelledError, which could stop other fixtures from being torn down or break later
tests that use the fixture. Also ensured ContextVars changed by async generator fixtures are
restored when their teardown raises. (#1591)
Notes for Downstream Packagers
pytest-asyncio v1.5.0
1.5.0 - 2026-11-12
Added
- A
fixture-scopevalue forasyncio_default_fixture_loop_scope. With it, an asynchronous fixture withoutloop_scopeuses itsscopeas its loop scope. This is the behavior of an unset option in pytest-asyncio 1.x. (#1095)
Fixed
- Invalid arguments to the
asynciomarker, including an invalidloop_scope, are reported with a message that names the test instead of a traceback. (#1584)
pytest-asyncio v1.4.1.post1
pytest-asyncio v1.4.1
1.4.1 - 2026-10-25
Added
- Declared support for Python 3.15 (#1588)
Fixed
- Allow AsyncIterable as a return type for asynchronous generator fixtures decorated with pytest_asyncio.fixture (#1090)
Notes for Downstream Packagers
- Source-tree development dependencies now use PEP 735 dependency groups and
uv.lock. (#1518)
pytest-asyncio v1.4.0
1.4.0 - 2026-05-26
Deprecated
- Overriding the event_loop_policy fixture is deprecated. Use the
pytest_asyncio_loop_factorieshook instead. (#1419)
Added
-
Added the
pytest_asyncio_loop_factorieshook to parametrize asyncio tests with custom event loop factories.The hook returns a mapping of factory names to loop factories, and
pytest.mark.asyncio(loop_factories=[...])selects a subset of configured factories per test. When a single factory is configured, test names are unchanged.Synchronous
@pytest_asyncio.fixturefunctions now see the correct event loop when custom loop factories are configured, even when test code disrupts the current event loop (e.g., viaasyncio.run()orasyncio.set_event_loop(None)). (#1164)
Changed
- Improved the readability of the warning message that is displayed when
asyncio_default_fixture_loop_scopeis unset (#1298) - Only import
asyncio.AbstractEventLoopPolicyfor type checking to avoid raising
a DeprecationWarning. (#1394) - Updated minimum supported pytest version to v8.4.0. (#1397)
Fixed
- Fixed a
ResourceWarning: unclosed event loopwarning that could occur when a synchronous test calledasyncio.run()or otherwise unset the current event loop after pytest-asyncio had run an async test or fixture. (#724)
Notes for Downstream Packagers
- Added dependency on
sphinx-tabs >= 3.5to organize documentation examples into tabs. (#1395)
pytest-asyncio v1.4.0a2
1.4.0a2 - 2026-05-02
Deprecated
- Overriding the event_loop_policy fixture is deprecated. Use the
pytest_asyncio_loop_factorieshook instead. (#1419)
Added
-
Added the
pytest_asyncio_loop_factorieshook to parametrize asyncio tests with custom event loop factories.The hook returns a mapping of factory names to loop factories, and
pytest.mark.asyncio(loop_factories=[...])selects a subset of configured factories per test. When a single factory is configured, test names are unchanged on pytest 8.4+.Synchronous
@pytest_asyncio.fixturefunctions now see the correct event loop when custom loop factories are configured, even when test code disrupts the current event loop (e.g., viaasyncio.run()orasyncio.set_event_loop(None)). (#1164)
Changed
- Improved the readability of the warning message that is displayed when
asyncio_default_fixture_loop_scopeis unset (#1298) - Only import
asyncio.AbstractEventLoopPolicyfor type checking to avoid raising
a DeprecationWarning. (#1394) - Updated minimum supported pytest version to v8.4.0. (#1397)
Fixed
- Fixed a
ResourceWarning: unclosed event loopwarning that could occur when a synchronous test calledasyncio.run()or otherwise unset the current event loop after pytest-asyncio had run an async test or fixture. (#724)
Notes for Downstream Packagers
- Added dependency on
sphinx-tabs >= 3.5to organize documentation examples into tabs. (#1395)
pytest-asyncio v1.4.0a1
1.4.0a1 - 2026-04-15
Added
-
Added the
pytest_asyncio_loop_factorieshook to parametrize asyncio tests with custom event loop factories.The hook returns a mapping of factory names to loop factories, and
pytest.mark.asyncio(loop_factories=[...])selects a subset of configured factories per test. When a single factory is configured, test names are unchanged on pytest 8.4+.Synchronous
@pytest_asyncio.fixturefunctions now see the correct event loop when custom loop factories are configured, even when test code disrupts the current event loop (e.g., viaasyncio.run()orasyncio.set_event_loop(None)). (#1164)
Changed
- Improved the readability of the warning message that is displayed when
asyncio_default_fixture_loop_scopeis unset (#1298) - Only import
asyncio.AbstractEventLoopPolicyfor type checking to avoid raising
a DeprecationWarning. (#1394) - Updated minimum supported pytest version to v8.4.0. (#1397)
Notes for Downstream Packagers
- Added dependency on
sphinx-tabs >= 3.5to organize documentation examples into tabs. (#1395)
pytest-asyncio 1.4.0a0
1.4.0a0 - 2026-03-25
Added
-
Added the
pytest_asyncio_loop_factorieshook to parametrize asyncio tests with custom event loop factories.The hook now returns a mapping of factory names to loop factories, and
pytest.mark.asyncio(loop_factories=[...])can be used to select a subset of configured factories per test. (#1164)
Changed
- Improved the readability of the warning message that is displayed when
asyncio_default_fixture_loop_scopeis unset (#1298)
pytest-asyncio 1.3.0
1.3.0 - 2025-11-10
Removed
- Support for Python 3.9 (#1278)
Added
- Support for pytest 9 (#1279)
Notes for Downstream Packagers
- Tested Python versions include free threaded Python 3.14t (#1274)
- Tests are run in the same pytest process, instead of spawning a subprocess with
pytest.Pytester.runpytest_subprocess. This prevents the test suite from accidentally using a system installation of pytest-asyncio, which could result in test errors. (#1275)
pytest-asyncio 1.2.0
1.2.0 - 2025-09-12
Added
--asyncio-debugCLI option andasyncio_debugconfiguration option to enable asyncio debug mode for the default event loop. (#980)- A
pytest.UsageErrorfor invalid configuration values ofasyncio_default_fixture_loop_scopeandasyncio_default_test_loop_scope. (#1189) - Compatibility with the Pyright type checker (#731)
Fixed
RuntimeError: There is no current event loop in thread 'MainThread'when any test unsets the event loop (such as when usingasyncio.runandasyncio.Runner). (#1177)- Deprecation warning when decorating an asynchronous fixture with
@pytest.fixturein [strict]{.title-ref} mode. The warning message now refers to the correct package. (#1198)
Notes for Downstream Packagers
- Bump the minimum required version of tox to v4.28. This change is only relevant if you use the
tox.inifile provided by pytest-asyncio to run tests. - Extend dependency on typing-extensions>=4.12 from Python<3.10 to Python<3.13.