Skip to content

Commit

Permalink
Fix propagate tags to IterationScenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
fliiiix committed Nov 4, 2023
1 parent 0f5e737 commit 8e40809
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
4 changes: 3 additions & 1 deletion radish/iterationscenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ class IterationScenario(Scenario):
"""

def __init__(self, id, keyword, sentence, path, line, parent, iteration, background=None):
super(IterationScenario, self).__init__(id, keyword, sentence, path, line, parent, background=background)
super(IterationScenario, self).__init__(
id, keyword, sentence, path, line, parent, parent.tags, background=background
)
self.iteration = iteration

def has_to_run(self, scenario_choice):
Expand Down
8 changes: 8 additions & 0 deletions tests/features/scenario-loop-tag.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Feature: Support Scenario Loop
Radish shall support Scenario Loops.

@arbitrary_tag
Scenario Loop 2: This is a looped Scenario
Given I have an instable function
When I execute it
Then I expect it to pass
13 changes: 13 additions & 0 deletions tests/functional/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,19 @@ def test_parse_feature_with_scenario_loop(parser):
assert feature.scenarios[0].scenarios[1].steps[2].sentence == "Then I expect it to pass"


@pytest.mark.parametrize("parser", [("scenario-loop-tag",)], indirect=["parser"])
def test_tags_are_propagated_to_iterationscenario_scenarios(parser):
"""
Test parsing a Feature with a simple Scenario Loop with tags
"""
# when
feature = parser.parse()

# then - expect tags are set from parent for each scenario
assert feature.scenarios[0].scenarios[0].tags == [Tag("arbitrary_tag")]
assert feature.scenarios[0].scenarios[1].tags == [Tag("arbitrary_tag")]


@pytest.mark.parametrize("parser", [("step-tabular-data",)], indirect=["parser"])
def test_parse_step_tabular_data(parser):
"""
Expand Down

0 comments on commit 8e40809

Please sign in to comment.