Skip to content

Releases

pytest-asyncio v2.0.0a1

Pre-release

Choose a tag to compare

@github-actions github-actions released this 13 Nov 16:56
v2.0.0a1
2c75752

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.fixture on async fixtures in strict mode raises pytest.UsageError instead of PytestDeprecationWarning (#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_test is now bool, so type checkers no longer narrow the item to pytest.Function. (#1598)

Fixed

  • Arguments to asyncio marks applied with pytest.param are 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

  • Removed the testing and docs extras, which duplicated the test and docs dependency groups. (#1594)
  • Removed the dependency on typing-extensions. (#1598)
  • Removed dependency on backports-asyncio-runner, which was needed to support Python <= 3.10 (#1618)

pytest-asyncio v1.5.0

Choose a tag to compare

@github-actions github-actions released this 12 Nov 16:35
v1.5.0

1.5.0 - 2026-11-12

Added

  • A fixture-scope value for asyncio_default_fixture_loop_scope. With it, an asynchronous fixture without loop_scope uses its scope as its loop scope. This is the behavior of an unset option in pytest-asyncio 1.x. (#1095)

Fixed

  • Invalid arguments to the asyncio marker, including an invalid loop_scope, are reported with a message that names the test instead of a traceback. (#1584)

pytest-asyncio v1.4.1.post1

Choose a tag to compare

@github-actions github-actions released this 01 Nov 18:26
v1.4.1.post1

1.4.1.post1 - 2026-11-01

Changed

  • Removed the upper version bound on the pytest dependency. (#1605)

pytest-asyncio v1.4.1

Choose a tag to compare

@github-actions github-actions released this 25 Oct 21:05
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

Choose a tag to compare

@github-actions github-actions released this 26 May 09:56
v1.4.0

1.4.0 - 2026-05-26

Deprecated

  • Overriding the event_loop_policy fixture is deprecated. Use the pytest_asyncio_loop_factories hook instead. (#1419)

Added

  • Added the pytest_asyncio_loop_factories hook 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.fixture functions now see the correct event loop when custom loop factories are configured, even when test code disrupts the current event loop (e.g., via asyncio.run() or asyncio.set_event_loop(None)). (#1164)

Changed

  • Improved the readability of the warning message that is displayed when asyncio_default_fixture_loop_scope is unset (#1298)
  • Only import asyncio.AbstractEventLoopPolicy for type checking to avoid raising
    a DeprecationWarning. (#1394)
  • Updated minimum supported pytest version to v8.4.0. (#1397)

Fixed

  • Fixed a ResourceWarning: unclosed event loop warning that could occur when a synchronous test called asyncio.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.5 to organize documentation examples into tabs. (#1395)

pytest-asyncio v1.4.0a2

Pre-release

Choose a tag to compare

@github-actions github-actions released this 15 May 08:03
v1.4.0a2

1.4.0a2 - 2026-05-02

Deprecated

  • Overriding the event_loop_policy fixture is deprecated. Use the pytest_asyncio_loop_factories hook instead. (#1419)

Added

  • Added the pytest_asyncio_loop_factories hook 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.fixture functions now see the correct event loop when custom loop factories are configured, even when test code disrupts the current event loop (e.g., via asyncio.run() or asyncio.set_event_loop(None)). (#1164)

Changed

  • Improved the readability of the warning message that is displayed when asyncio_default_fixture_loop_scope is unset (#1298)
  • Only import asyncio.AbstractEventLoopPolicy for type checking to avoid raising
    a DeprecationWarning. (#1394)
  • Updated minimum supported pytest version to v8.4.0. (#1397)

Fixed

  • Fixed a ResourceWarning: unclosed event loop warning that could occur when a synchronous test called asyncio.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.5 to organize documentation examples into tabs. (#1395)

pytest-asyncio v1.4.0a1

Pre-release

Choose a tag to compare

@github-actions github-actions released this 15 Apr 14:30
v1.4.0a1

1.4.0a1 - 2026-04-15

Added

  • Added the pytest_asyncio_loop_factories hook 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.fixture functions now see the correct event loop when custom loop factories are configured, even when test code disrupts the current event loop (e.g., via asyncio.run() or asyncio.set_event_loop(None)). (#1164)

Changed

  • Improved the readability of the warning message that is displayed when asyncio_default_fixture_loop_scope is unset (#1298)
  • Only import asyncio.AbstractEventLoopPolicy for 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.5 to organize documentation examples into tabs. (#1395)

pytest-asyncio 1.4.0a0

Pre-release

Choose a tag to compare

@github-actions github-actions released this 15 Apr 14:29
v1.4.0a0

1.4.0a0 - 2026-03-25

Added

  • Added the pytest_asyncio_loop_factories hook 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_scope is unset (#1298)

pytest-asyncio 1.3.0

Choose a tag to compare

@github-actions github-actions released this 10 Nov 16:08
v1.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

Choose a tag to compare

@github-actions github-actions released this 12 Sep 07:34
v1.2.0

1.2.0 - 2025-09-12

Added

  • --asyncio-debug CLI option and asyncio_debug configuration option to enable asyncio debug mode for the default event loop. (#980)
  • A pytest.UsageError for invalid configuration values of asyncio_default_fixture_loop_scope and asyncio_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 using asyncio.run and asyncio.Runner). (#1177)
  • Deprecation warning when decorating an asynchronous fixture with @pytest.fixture in [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.ini file provided by pytest-asyncio to run tests.
  • Extend dependency on typing-extensions>=4.12 from Python<3.10 to Python<3.13.