3434
3535 from .parser import Feature , Scenario , ScenarioTemplate , Step
3636
37- P = ParamSpec ("P" )
3837T = TypeVar ("T" )
3938
4039logger = logging .getLogger (__name__ )
@@ -201,14 +200,14 @@ def _execute_scenario(feature: Feature, scenario: Scenario, request: FixtureRequ
201200
202201def _get_scenario_decorator (
203202 feature : Feature , feature_name : str , templated_scenario : ScenarioTemplate , scenario_name : str
204- ) -> Callable [[Callable [P , T ]], Callable [P , T ]]:
203+ ) -> Callable [[Callable [... , T ]], Callable [... , T ]]:
205204 # HACK: Ideally we would use `def decorator(fn)`, but we want to return a custom exception
206205 # when the decorator is misused.
207206 # Pytest inspect the signature to determine the required fixtures, and in that case it would look
208207 # for a fixture called "fn" that doesn't exist (if it exists then it's even worse).
209208 # It will error with a "fixture 'fn' not found" message instead.
210209 # We can avoid this hack by using a pytest hook and check for misuse instead.
211- def decorator (* args : Callable [P , T ]) -> Callable [P , T ]:
210+ def decorator (* args : Callable [... , T ]) -> Callable [... , T ]:
212211 if not args :
213212 raise exceptions .ScenarioIsDecoratorOnly (
214213 "scenario function can only be used as a decorator. Refer to the documentation."
@@ -241,7 +240,7 @@ def scenario_wrapper(request: FixtureRequest, _pytest_bdd_example: dict[str, str
241240 scenario_wrapper .__doc__ = f"{ feature_name } : { scenario_name } "
242241
243242 scenario_wrapper_template_registry [scenario_wrapper ] = templated_scenario
244- return cast ( Callable [ P , T ], scenario_wrapper )
243+ return scenario_wrapper
245244
246245 return decorator
247246
@@ -260,7 +259,7 @@ def scenario(
260259 scenario_name : str ,
261260 encoding : str = "utf-8" ,
262261 features_base_dir : str | None = None ,
263- ) -> Callable [[Callable [P , T ]], Callable [P , T ]]:
262+ ) -> Callable [[Callable [... , T ]], Callable [... , T ]]:
264263 """Scenario decorator.
265264
266265 :param str feature_name: Feature file name. Absolute or relative to the configured feature base path.
0 commit comments