Skip to content

Commit dd145a2

Browse files
committed
Response to feedback: now yield scenario
1 parent 2d40d7a commit dd145a2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/pytest_bdd/parser.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,7 @@ def _parse_and_add_rule(self, rule_data: GherkinRule, feature: Feature) -> None:
505505
rule.add_background(background)
506506

507507
# Parse and add scenarios under the rule
508-
for rule_scenario in self._extract_rule_scenarios(rule_data):
509-
scenario = self.parse_scenario(rule_scenario, feature, rule)
508+
for scenario in self._extract_rule_scenarios(rule_data, feature, rule):
510509
feature.scenarios[scenario.name] = scenario
511510

512511
def _extract_rule_background(self, rule_data: GherkinRule) -> Background | None:
@@ -516,12 +515,13 @@ def _extract_rule_background(self, rule_data: GherkinRule) -> Background | None:
516515
return self.parse_background(child.background)
517516
return None
518517

519-
@staticmethod
520-
def _extract_rule_scenarios(rule_data: GherkinRule) -> Generator[GherkinScenario]:
521-
"""Yield each scenario under a rule."""
518+
def _extract_rule_scenarios(
519+
self, rule_data: GherkinRule, feature: Feature, rule: Rule
520+
) -> Generator[ScenarioTemplate]:
521+
"""Yield each parsed scenario under a rule."""
522522
for child in rule_data.children:
523523
if child.scenario:
524-
yield child.scenario
524+
yield self.parse_scenario(child.scenario, feature, rule)
525525

526526
def _parse_and_add_scenario(
527527
self, scenario_data: GherkinScenario, feature: Feature, rule: Rule | None = None

0 commit comments

Comments
 (0)