@@ -275,13 +275,9 @@ def _synchronize_async_fixture(fixturedef: FixtureDef) -> None:
275275 """
276276 Wraps the fixture function of an async fixture in a synchronous function.
277277 """
278- if inspect .isasyncgenfunction (fixturedef .func ) or getattr (
279- fixturedef .func , "_async_fixture" , False
280- ):
278+ if inspect .isasyncgenfunction (fixturedef .func ):
281279 _wrap_asyncgen_fixture (fixturedef )
282- elif inspect .iscoroutinefunction (fixturedef .func ) or getattr (
283- fixturedef .func , "_async_fixture" , False
284- ):
280+ elif inspect .iscoroutinefunction (fixturedef .func ):
285281 _wrap_async_fixture (fixturedef )
286282
287283
@@ -321,8 +317,6 @@ def _perhaps_rebind_fixture_func(
321317
322318def _wrap_asyncgen_fixture (fixturedef : FixtureDef ) -> None :
323319 fixture = fixturedef .func
324- if getattr (fixture , "_async_fixture" , False ):
325- return fixture
326320
327321 @functools .wraps (fixture )
328322 def _asyncgen_fixture_wrapper (request : FixtureRequest , ** kwargs : Any ):
@@ -369,17 +363,12 @@ async def async_finalizer() -> None:
369363 request .addfinalizer (finalizer )
370364 return result
371365
372- setattr (_asyncgen_fixture_wrapper , "_async_fixture" , True )
373-
374366 fixturedef .func = _asyncgen_fixture_wrapper
375367
376368
377369def _wrap_async_fixture (fixturedef : FixtureDef ) -> None :
378370 fixture = fixturedef .func
379371
380- if getattr (fixture , "_async_fixture" , False ):
381- return fixture
382-
383372 @functools .wraps (fixture )
384373 def _async_fixture_wrapper (request : FixtureRequest , ** kwargs : Any ):
385374 unittest = False if pytest .version_tuple >= (8 , 2 ) else fixturedef .unittest
@@ -407,8 +396,6 @@ async def setup():
407396
408397 return event_loop .run_until_complete (setup ())
409398
410- setattr (_async_fixture_wrapper , "_async_fixture" , True )
411-
412399 fixturedef .func = _async_fixture_wrapper
413400
414401
0 commit comments