Skip to content

Commit

Permalink
Fix compatibility with pytest 8.2 FixtureDef.unittest removal
Browse files Browse the repository at this point in the history
Since pytest 8.2 unittest and regular behave the same, so unittest
special handling is no longer needed.
  • Loading branch information
bluetech authored and seifertm committed Mar 19, 2024
1 parent 13d4b79 commit 143f745
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pytest_asyncio/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,8 @@ def _wrap_asyncgen_fixture(fixturedef: FixtureDef, event_loop_fixture_id: str) -

@functools.wraps(fixture)
def _asyncgen_fixture_wrapper(request: FixtureRequest, **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)
event_loop = kwargs.pop(event_loop_fixture_id)
gen_obj = func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
Expand Down Expand Up @@ -354,9 +353,8 @@ def _wrap_async_fixture(fixturedef: FixtureDef, event_loop_fixture_id: str) -> N

@functools.wraps(fixture)
def _async_fixture_wrapper(request: FixtureRequest, **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)
event_loop = kwargs.pop(event_loop_fixture_id)

async def setup():
Expand Down

0 comments on commit 143f745

Please sign in to comment.