5151)
5252
5353if sys .version_info >= (3 , 10 ):
54- from typing import Concatenate , ParamSpec
54+ from typing import ParamSpec
5555else :
56- from typing_extensions import Concatenate , ParamSpec
56+ from typing_extensions import ParamSpec
5757
5858if sys .version_info >= (3 , 11 ):
5959 from asyncio import Runner
@@ -240,9 +240,9 @@ def _fixture_synchronizer(
240240 """Returns a synchronous function evaluating the specified fixture."""
241241 fixture_function = resolve_fixture_function (fixturedef , request )
242242 if inspect .isasyncgenfunction (fixturedef .func ):
243- return _wrap_asyncgen_fixture (fixture_function , runner ) # type: ignore[arg-type]
243+ return _wrap_asyncgen_fixture (fixture_function , runner , request ) # type: ignore[arg-type]
244244 elif inspect .iscoroutinefunction (fixturedef .func ):
245- return _wrap_async_fixture (fixture_function , runner ) # type: ignore[arg-type]
245+ return _wrap_async_fixture (fixture_function , runner , request ) # type: ignore[arg-type]
246246 else :
247247 return fixturedef .func
248248
@@ -268,18 +268,14 @@ def _wrap_asyncgen_fixture(
268268 AsyncGenFixtureParams , AsyncGeneratorType [AsyncGenFixtureYieldType , Any ]
269269 ],
270270 runner : Runner ,
271- ) -> Callable [
272- Concatenate [FixtureRequest , AsyncGenFixtureParams ], AsyncGenFixtureYieldType
273- ]:
271+ request : FixtureRequest ,
272+ ) -> Callable [AsyncGenFixtureParams , AsyncGenFixtureYieldType ]:
274273 @functools .wraps (fixture_function )
275274 def _asyncgen_fixture_wrapper (
276- request : FixtureRequest ,
277275 * args : AsyncGenFixtureParams .args ,
278276 ** kwargs : AsyncGenFixtureParams .kwargs ,
279277 ):
280- gen_obj = fixture_function (
281- * args , ** _add_kwargs (fixture_function , kwargs , request )
282- )
278+ gen_obj = fixture_function (* args , ** kwargs )
283279
284280 async def setup ():
285281 res = await gen_obj .__anext__ () # type: ignore[union-attr]
@@ -322,18 +318,16 @@ def _wrap_async_fixture(
322318 AsyncFixtureParams , CoroutineType [Any , Any , AsyncFixtureReturnType ]
323319 ],
324320 runner : Runner ,
325- ) -> Callable [Concatenate [FixtureRequest , AsyncFixtureParams ], AsyncFixtureReturnType ]:
321+ request : FixtureRequest ,
322+ ) -> Callable [AsyncFixtureParams , AsyncFixtureReturnType ]:
326323
327324 @functools .wraps (fixture_function ) # type: ignore[arg-type]
328325 def _async_fixture_wrapper (
329- request : FixtureRequest ,
330326 * args : AsyncFixtureParams .args ,
331327 ** kwargs : AsyncFixtureParams .kwargs ,
332328 ):
333329 async def setup ():
334- res = await fixture_function (
335- * args , ** _add_kwargs (fixture_function , kwargs , request )
336- )
330+ res = await fixture_function (* args , ** kwargs )
337331 return res
338332
339333 context = contextvars .copy_context ()
@@ -737,8 +731,6 @@ def pytest_fixture_setup(fixturedef: FixtureDef, request) -> object | None:
737731 synchronizer = _fixture_synchronizer (fixturedef , runner , request )
738732 _make_asyncio_fixture_function (synchronizer , loop_scope )
739733 with MonkeyPatch .context () as c :
740- if "request" not in fixturedef .argnames :
741- c .setattr (fixturedef , "argnames" , (* fixturedef .argnames , "request" ))
742734 c .setattr (fixturedef , "func" , synchronizer )
743735 hook_result = yield
744736 return hook_result
0 commit comments