File tree Expand file tree Collapse file tree 2 files changed +0
-43
lines changed Expand file tree Collapse file tree 2 files changed +0
-43
lines changed Original file line number Diff line number Diff line change 2323 exceptions .FeatureError ,
2424 "Multiple features are not allowed in a single feature file." ,
2525 ),
26- (
27- re .compile (r"expected:.*got '(?:Given|When|Then|And|But).*'" ),
28- exceptions .FeatureError ,
29- "Step definition outside of a Scenario or a Background." ,
30- ),
3126 (
3227 re .compile (r"expected:.*got 'Background.*'" ),
3328 exceptions .BackgroundError ,
Original file line number Diff line number Diff line change @@ -34,44 +34,6 @@ def test_multiple_features_error(pytester):
3434 result .stdout .fnmatch_lines (["*FeatureError: Multiple features are not allowed in a single feature file.*" ])
3535
3636
37- def test_step_outside_scenario_or_background_error (pytester ):
38- """Test step outside of a Scenario or Background."""
39- features = pytester .mkdir ("features" )
40- features .joinpath ("test.feature" ).write_text (
41- textwrap .dedent (
42- """
43- Feature: Invalid Feature
44- # Step not inside a scenario or background
45- Given a step that is not inside a scenario or background
46-
47- Scenario: A valid scenario
48- Given a step inside a scenario
49-
50- """
51- ),
52- encoding = "utf-8" ,
53- )
54-
55- pytester .makepyfile (
56- textwrap .dedent (
57- """
58- from pytest_bdd import scenarios, given
59-
60- @given("a step inside a scenario")
61- def step_inside_scenario():
62- pass
63-
64- scenarios('features')
65- """
66- )
67- )
68-
69- result = pytester .runpytest ()
70-
71- # Expect the FeatureError for the step outside of scenario or background
72- result .stdout .fnmatch_lines (["*FeatureError: Step definition outside of a Scenario or a Background.*" ])
73-
74-
7537def test_multiple_backgrounds_error (pytester ):
7638 """Test multiple backgrounds in a single feature."""
7739 features = pytester .mkdir ("features" )
You can’t perform that action at this time.
0 commit comments