@@ -275,13 +275,9 @@ def _synchronize_async_fixture(fixturedef: FixtureDef) -> None:
275
275
"""
276
276
Wraps the fixture function of an async fixture in a synchronous function.
277
277
"""
278
- if inspect .isasyncgenfunction (fixturedef .func ) or getattr (
279
- fixturedef .func , "_async_fixture" , False
280
- ):
278
+ if inspect .isasyncgenfunction (fixturedef .func ):
281
279
_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 ):
285
281
_wrap_async_fixture (fixturedef )
286
282
287
283
@@ -321,8 +317,6 @@ def _perhaps_rebind_fixture_func(
321
317
322
318
def _wrap_asyncgen_fixture (fixturedef : FixtureDef ) -> None :
323
319
fixture = fixturedef .func
324
- if getattr (fixture , "_async_fixture" , False ):
325
- return fixture
326
320
327
321
@functools .wraps (fixture )
328
322
def _asyncgen_fixture_wrapper (request : FixtureRequest , ** kwargs : Any ):
@@ -369,17 +363,12 @@ async def async_finalizer() -> None:
369
363
request .addfinalizer (finalizer )
370
364
return result
371
365
372
- setattr (_asyncgen_fixture_wrapper , "_async_fixture" , True )
373
-
374
366
fixturedef .func = _asyncgen_fixture_wrapper
375
367
376
368
377
369
def _wrap_async_fixture (fixturedef : FixtureDef ) -> None :
378
370
fixture = fixturedef .func
379
371
380
- if getattr (fixture , "_async_fixture" , False ):
381
- return fixture
382
-
383
372
@functools .wraps (fixture )
384
373
def _async_fixture_wrapper (request : FixtureRequest , ** kwargs : Any ):
385
374
unittest = False if pytest .version_tuple >= (8 , 2 ) else fixturedef .unittest
@@ -407,8 +396,6 @@ async def setup():
407
396
408
397
return event_loop .run_until_complete (setup ())
409
398
410
- setattr (_async_fixture_wrapper , "_async_fixture" , True )
411
-
412
399
fixturedef .func = _async_fixture_wrapper
413
400
414
401
0 commit comments