1919import re
2020from collections .abc import Iterable , Iterator
2121from inspect import signature
22- from typing import TYPE_CHECKING , Any , Callable , TypeVar , cast
22+ from typing import TYPE_CHECKING , Callable , TypeVar , cast
2323from weakref import WeakKeyDictionary
2424
2525import 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