MCPcopy Create free account
hub / github.com/pytest-dev/pytest-bdd / test_misplaced_rule_error

Function test_misplaced_rule_error

tests/parser/test_errors.py:156–187  ·  view source on GitHub ↗

Test misplaced or incorrectly formatted Rule.

(pytester)

Source from the content-addressed store, hash-verified

154
155
156def test_misplaced_rule_error(pytester):
157 """Test misplaced or incorrectly formatted Rule."""
158 features = pytester.mkdir("features")
159 features.joinpath("test.feature").write_text(
160 textwrap.dedent(
161 """
162 Rule: Misplaced rule
163 Feature: Feature with misplaced rule
164 Scenario: A scenario inside a rule
165 Given a step
166 """
167 ),
168 encoding="utf-8",
169 )
170 pytester.makepyfile(
171 textwrap.dedent(
172 """
173 from pytest_bdd import given, scenarios
174
175 scenarios('features')
176
177 @given("a step")
178 def a_step():
179 pass
180 """
181 )
182 )
183
184 result = pytester.runpytest()
185 result.stdout.fnmatch_lines(
186 ["*RuleError: Misplaced or incorrectly formatted 'Rule'. Ensure it follows the feature structure.*"]
187 )
188
189
190def test_improper_step_error(pytester):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…