Skip to content

Commit 06ef78e

Browse files
committed
refactor: _wrap_asyncgen_fixture returns a Callable rather than modifying the FixtureDef
1 parent d05365b commit 06ef78e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pytest_asyncio/plugin.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def _preprocess_async_fixtures(
266266
def _synchronize_async_fixture(fixturedef: FixtureDef) -> None:
267267
"""Wraps the fixture function of an async fixture in a synchronous function."""
268268
if inspect.isasyncgenfunction(fixturedef.func):
269-
_wrap_asyncgen_fixture(fixturedef)
269+
fixturedef.func = _wrap_asyncgen_fixture(fixturedef) # type: ignore[misc]
270270
elif inspect.iscoroutinefunction(fixturedef.func):
271271
fixturedef.func = _wrap_async_fixture(fixturedef) # type: ignore[misc]
272272

@@ -299,7 +299,7 @@ def _perhaps_rebind_fixture_func(func: _T, instance: Any | None) -> _T:
299299
return func
300300

301301

302-
def _wrap_asyncgen_fixture(fixturedef: FixtureDef) -> None:
302+
def _wrap_asyncgen_fixture(fixturedef: FixtureDef) -> Callable:
303303
fixture = fixturedef.func
304304

305305
@functools.wraps(fixture)
@@ -343,7 +343,7 @@ async def async_finalizer() -> None:
343343
request.addfinalizer(finalizer)
344344
return result
345345

346-
fixturedef.func = _asyncgen_fixture_wrapper # type: ignore[misc]
346+
return _asyncgen_fixture_wrapper
347347

348348

349349
def _wrap_async_fixture(fixturedef: FixtureDef) -> Callable:

0 commit comments

Comments
 (0)