Test misplaced or incorrectly formatted Rule.
(pytester)
| 154 | |
| 155 | |
| 156 | def 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 | |
| 190 | def test_improper_step_error(pytester): |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…