Skip to content

Made 0.21.1 compatible with pytest 8.2.0 #823

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/source/reference/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Changelog
=========

0.21.2 (2024-04-29)
===================
- Fix compatibility with pytest 8.2. Backport of `#800 <https://github.com/pytest-dev/pytest-asyncio/pull/800>`_ to pytest-asyncio v0.21 for users who are unable to upgrade to a more recent version (see `#706 <https://github.com/pytest-dev/pytest-asyncio/pull/706>`_)

0.21.1 (2023-07-12)
===================
- Output a proper error message when an invalid ``asyncio_mode`` is selected.
Expand Down
12 changes: 5 additions & 7 deletions pytest_asyncio/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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():
Expand Down Expand Up @@ -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))
Expand Down