Skip to content

Commit 5e5c60f

Browse files
committed
Remove usages of Any from scenario.py
1 parent ad221be commit 5e5c60f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Diff for: src/pytest_bdd/scenario.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import re
2020
from collections.abc import Iterable, Iterator
2121
from inspect import signature
22-
from typing import TYPE_CHECKING, Any, Callable, TypeVar, cast
22+
from typing import TYPE_CHECKING, Callable, TypeVar, cast
2323
from weakref import WeakKeyDictionary
2424

2525
import pytest
@@ -444,15 +444,17 @@ def get_name() -> str:
444444
suffix = f"_{index}"
445445

446446

447-
def scenarios(*feature_paths: str, **kwargs: Any) -> None:
447+
def scenarios(*feature_paths: str, encoding: str = "utf-8", features_base_dir: str | None = None) -> None:
448+
caller_locals = get_caller_module_locals()
448449
"""Parse features from the paths and put all found scenarios in the caller module.
449450
450451
:param *feature_paths: feature file paths to use for scenarios
452+
:param str encoding: Feature file encoding.
453+
:param features_base_dir: Optional base dir location for locating feature files. If not set, it will try and
454+
resolve using property set in .ini file, otherwise it is assumed to be relative from the caller path location.
451455
"""
452-
caller_locals = get_caller_module_locals()
453456
caller_path = get_caller_module_path()
454457

455-
features_base_dir = kwargs.get("features_base_dir")
456458
if features_base_dir is None:
457459
features_base_dir = get_features_base_dir(caller_path)
458460

@@ -474,7 +476,7 @@ def scenarios(*feature_paths: str, **kwargs: Any) -> None:
474476
# skip already bound scenarios
475477
if (scenario_object.feature.filename, scenario_name) not in module_scenarios:
476478

477-
@scenario(feature.filename, scenario_name, **kwargs)
479+
@scenario(feature.filename, scenario_name, encoding=encoding, features_base_dir=features_base_dir)
478480
def _scenario() -> None:
479481
pass # pragma: no cover
480482

0 commit comments

Comments
 (0)