Skip to content

Commit 9c12dbf

Browse files
committed
Forgot to fix background in steps and revert test that was skipped
1 parent c3008c1 commit 9c12dbf

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/pytest_bdd/parser.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,8 @@ def parse_background(self, background_data: GherkinBackground, feature: Feature)
419419
line_number=background_data.location.line,
420420
)
421421
background.steps = self.parse_steps(background_data.steps)
422+
for step in background.steps:
423+
step.background = background
422424
return background
423425

424426
def _parse_feature_file(self) -> GherkinDocument:

tests/generation/test_generate_missing.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ def test_generate_missing(pytester):
2929
Scenario: Scenario tests which are already bound to the tests stay as is
3030
Given I have a bar
3131
32+
3233
Scenario: Code is generated for scenarios which are not bound to any tests
3334
Given I have a bar
3435
36+
3537
Scenario: Code is generated for scenario steps which are not yet defined(implemented)
3638
Given I have a custom bar
3739
"""
@@ -78,6 +80,10 @@ def test_missing_steps():
7880
]
7981
)
8082

83+
result.stdout.fnmatch_lines(
84+
['Step Given "I have a foobar" is not defined in the background of the feature "Missing code generation" *']
85+
)
86+
8187
result.stdout.fnmatch_lines(["Please place the code above to the test file(s):"])
8288

8389

0 commit comments

Comments
 (0)