From afa91e1005dc1bd59369294652d17f7b00e8163a Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Mon, 29 Apr 2024 09:12:52 +0200 Subject: [PATCH 1/2] Backported #800 to the 0.21.1 tag This unblocks all users stuck with 0.21.1 due to #706 --- pytest_asyncio/plugin.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pytest_asyncio/plugin.py b/pytest_asyncio/plugin.py index 12669791..1db1710e 100644 --- a/pytest_asyncio/plugin.py +++ b/pytest_asyncio/plugin.py @@ -240,7 +240,7 @@ def _add_kwargs( func: Callable[..., Any], kwargs: Dict[str, Any], event_loop: asyncio.AbstractEventLoop, - request: SubRequest, + request: FixtureRequest, ) -> Dict[str, Any]: sig = inspect.signature(func) ret = kwargs.copy() @@ -277,9 +277,8 @@ def _wrap_asyncgen_fixture(fixturedef: FixtureDef) -> None: def _asyncgen_fixture_wrapper( event_loop: asyncio.AbstractEventLoop, request: SubRequest, **kwargs: Any ): - func = _perhaps_rebind_fixture_func( - fixture, request.instance, fixturedef.unittest - ) + unittest = False if pytest.version_tuple >= (8, 2) else fixturedef.unittest + func = _perhaps_rebind_fixture_func(fixture, request.instance, unittest) gen_obj = func(**_add_kwargs(func, kwargs, event_loop, request)) async def setup(): @@ -315,9 +314,8 @@ def _wrap_async_fixture(fixturedef: FixtureDef) -> None: def _async_fixture_wrapper( event_loop: asyncio.AbstractEventLoop, request: SubRequest, **kwargs: Any ): - func = _perhaps_rebind_fixture_func( - fixture, request.instance, fixturedef.unittest - ) + unittest = False if pytest.version_tuple >= (8, 2) else fixturedef.unittest + func = _perhaps_rebind_fixture_func(fixture, request.instance, unittest) async def setup(): res = await func(**_add_kwargs(func, kwargs, event_loop, request)) From 773e52bfb59d526dfa23051c1d3a767d65bb79e4 Mon Sep 17 00:00:00 2001 From: Michael Seifert Date: Mon, 29 Apr 2024 14:39:19 +0200 Subject: [PATCH 2/2] [docs] Added changelog entry. Signed-off-by: Michael Seifert --- docs/source/reference/changelog.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/source/reference/changelog.rst b/docs/source/reference/changelog.rst index d57a4a3d..170ba29a 100644 --- a/docs/source/reference/changelog.rst +++ b/docs/source/reference/changelog.rst @@ -2,6 +2,10 @@ Changelog ========= +0.21.2 (2024-04-29) +=================== +- Fix compatibility with pytest 8.2. Backport of `#800 `_ to pytest-asyncio v0.21 for users who are unable to upgrade to a more recent version (see `#706 `_) + 0.21.1 (2023-07-12) =================== - Output a proper error message when an invalid ``asyncio_mode`` is selected.