Skip to content

Commit

Permalink
Backported pytest-dev#800 to the 0.21.1 tag
Browse files Browse the repository at this point in the history
This unblocks all users stuck with 0.21.1 due to pytest-dev#706
  • Loading branch information
ffissore committed Apr 29, 2024
1 parent a10cbde commit afa91e1
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions pytest_asyncio/plugin.py
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

0 comments on commit afa91e1

Please sign in to comment.