@@ -47,7 +47,7 @@ def find_fixturedefs_for_step(step: Step, fixturemanager: FixtureManager, nodeid
4747 """Find the fixture defs that can parse a step."""
4848 # happens to be that _arg2fixturedefs is changed during the iteration so we use a copy
4949 fixture_def_by_name = list (fixturemanager ._arg2fixturedefs .items ())
50- for i , ( fixturename , fixturedefs ) in enumerate ( fixture_def_by_name ) :
50+ for fixturename , fixturedefs in fixture_def_by_name :
5151 for pos , fixturedef in enumerate (fixturedefs ):
5252 step_func_context = getattr (fixturedef .func , "_pytest_bdd_step_context" , None )
5353 if step_func_context is None :
@@ -245,14 +245,11 @@ def scenario_wrapper(request: FixtureRequest, _pytest_bdd_example: dict[str, str
245245def collect_example_parametrizations (
246246 templated_scenario : ScenarioTemplate ,
247247) -> list [ParameterSet ] | None :
248- # We need to evaluate these iterators and store them as lists, otherwise
249- # we won't be able to do the cartesian product later (the second iterator will be consumed)
250- contexts = list (templated_scenario .examples .as_contexts ())
251- if not contexts :
248+ if contexts := list (templated_scenario .examples .as_contexts ()):
249+ return [pytest .param (context , id = "-" .join (context .values ())) for context in contexts ]
250+ else :
252251 return None
253252
254- return [pytest .param (context , id = "-" .join (context .values ())) for context in contexts ]
255-
256253
257254def scenario (
258255 feature_name : str ,
@@ -267,7 +264,7 @@ def scenario(
267264 :param str encoding: Feature file encoding.
268265 """
269266 __tracebackhide__ = True
270- scenario_name = str ( scenario_name )
267+ scenario_name = scenario_name
271268 caller_module_path = get_caller_module_path ()
272269
273270 # Get the feature
0 commit comments