Skip to content

Commit 49f363e

Browse files
committed
Improve type specificity
1 parent 6f3dd9d commit 49f363e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pytest_bdd/scenario.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,14 +257,14 @@ def _execute_scenario(feature: Feature, scenario: Scenario, request: FixtureRequ
257257

258258
def _get_scenario_decorator(
259259
feature: Feature, feature_name: str, templated_scenario: ScenarioTemplate, scenario_name: str
260-
) -> Callable[[Callable[..., T]], Callable[..., T]]:
260+
) -> Callable[[Callable[..., T]], Callable[[FixtureRequest, dict[str, str]], T]]:
261261
# HACK: Ideally we would use `def decorator(fn)`, but we want to return a custom exception
262262
# when the decorator is misused.
263263
# Pytest inspect the signature to determine the required fixtures, and in that case it would look
264264
# for a fixture called "fn" that doesn't exist (if it exists then it's even worse).
265265
# It will error with a "fixture 'fn' not found" message instead.
266266
# We can avoid this hack by using a pytest hook and check for misuse instead.
267-
def decorator(*args: Callable[..., T]) -> Callable[..., T]:
267+
def decorator(*args: Callable[..., T]) -> Callable[[FixtureRequest, dict[str, str]], T]:
268268
if not args:
269269
raise exceptions.ScenarioIsDecoratorOnly(
270270
"scenario function can only be used as a decorator. Refer to the documentation."

0 commit comments

Comments
 (0)