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

Function test_when_first

tests/feature/test_steps.py:180–217  ·  view source on GitHub ↗
(pytester)

Source from the content-addressed store, hash-verified

178
179
180def 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
220def test_then_after_given(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…