Skip to content

Commit 496fabb

Browse files
committed
Scenario example validation restrictions removed.
1 parent 2fb5a11 commit 496fabb

File tree

3 files changed

+8
-30
lines changed

3 files changed

+8
-30
lines changed

pytest_bdd/exceptions.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,6 @@ class ExamplesNotValidError(ScenarioValidationError):
1717
"""Example table is not valid."""
1818

1919

20-
class ScenarioExamplesNotValidError(ScenarioValidationError):
21-
"""Scenario steps parameters do not match declared scenario examples."""
22-
23-
24-
class FeatureExamplesNotValidError(ScenarioValidationError):
25-
"""Feature example table is not valid."""
26-
27-
2820
class StepDefinitionNotFoundError(Exception):
2921
"""Step definition not found."""
3022

pytest_bdd/parser.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -234,19 +234,8 @@ def render(self, context: typing.Mapping[str, typing.Any]) -> "Scenario":
234234
return Scenario(feature=self.feature, name=self.name, line_number=self.line_number, steps=steps, tags=self.tags)
235235

236236
def validate(self):
237-
"""Validate the scenario.
238-
239-
:raises ScenarioValidationError: when scenario is not valid
240-
"""
241-
params = frozenset(sum((list(step.params) for step in self.steps), []))
242-
example_params = set(self.examples.example_params)
243-
if params and example_params and params != example_params:
244-
raise exceptions.ScenarioExamplesNotValidError(
245-
"""Scenario "{}" in the feature "{}" has not valid examples. """
246-
"""Set of step parameters {} should match set of example values {}.""".format(
247-
self.name, self.feature.filename, sorted(params), sorted(example_params)
248-
)
249-
)
237+
"""Validate the scenario."""
238+
pass
250239

251240

252241
class Scenario:

tests/feature/test_outline.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,15 @@ def test_wrongly_outlined(testdir):
8787
outline=textwrap.dedent(
8888
"""\
8989
Feature: Outline
90-
Scenario Outline: Outlined with wrong examples
90+
Scenario Outline: Outlined with unused params
9191
Given there are <start> cucumbers
9292
When I eat <eat> cucumbers
93+
# And commented out step with <unused_param>
9394
Then I should have <left> cucumbers
9495
9596
Examples:
96-
| start | eat | left | unknown_param |
97-
| 12 | 5 | 7 | value |
97+
| start | eat | left | unused_param |
98+
| 12 | 5 | 7 | value |
9899
99100
"""
100101
),
@@ -106,18 +107,14 @@ def test_wrongly_outlined(testdir):
106107
"""\
107108
from pytest_bdd import scenario
108109
109-
@scenario("outline.feature", "Outlined with wrong examples")
110+
@scenario("outline.feature", "Outlined with unused params")
110111
def test_outline(request):
111112
pass
112113
"""
113114
)
114115
)
115116
result = testdir.runpytest()
116-
assert_outcomes(result, errors=1)
117-
result.stdout.fnmatch_lines(
118-
'*ScenarioExamplesNotValidError: Scenario "Outlined with wrong examples"*has not valid examples*',
119-
)
120-
result.stdout.fnmatch_lines("*should match set of example values [[]'eat', 'left', 'start', 'unknown_param'[]].*")
117+
assert_outcomes(result, passed=1)
121118

122119

123120
def test_outlined_with_other_fixtures(testdir):

0 commit comments

Comments
 (0)