(pytester)
| 178 | |
| 179 | |
| 180 | def test_when_first(pytester): |
| 181 | pytester.makefile( |
| 182 | ".feature", |
| 183 | steps=textwrap.dedent( |
| 184 | """\ |
| 185 | Feature: Steps are executed one by one |
| 186 | Steps are executed one by one. Given and When sections |
| 187 | are not mandatory in some cases. |
| 188 | |
| 189 | Scenario: When step can be the first |
| 190 | When I do nothing |
| 191 | Then I make no mistakes |
| 192 | """ |
| 193 | ), |
| 194 | ) |
| 195 | pytester.makepyfile( |
| 196 | textwrap.dedent( |
| 197 | """\ |
| 198 | from pytest_bdd import when, then, scenario |
| 199 | |
| 200 | @scenario("steps.feature", "When step can be the first") |
| 201 | def test_steps(): |
| 202 | pass |
| 203 | |
| 204 | @when("I do nothing") |
| 205 | def _(): |
| 206 | pass |
| 207 | |
| 208 | |
| 209 | @then("I make no mistakes") |
| 210 | def _(): |
| 211 | assert True |
| 212 | |
| 213 | """ |
| 214 | ) |
| 215 | ) |
| 216 | result = pytester.runpytest() |
| 217 | result.assert_outcomes(passed=1, failed=0) |
| 218 | |
| 219 | |
| 220 | def test_then_after_given(pytester): |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…