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

Function test_given_injection

tests/steps/test_given.py:6–41  ·  view source on GitHub ↗
(pytester)

Source from the content-addressed store, hash-verified

4
5
6def test_given_injection(pytester):
7 pytester.makefile(
8 ".feature",
9 given=textwrap.dedent(
10 """\
11 Feature: Given
12 Scenario: Test given fixture injection
13 Given I have injecting given
14 Then foo should be "injected foo"
15 """
16 ),
17 )
18 pytester.makepyfile(
19 textwrap.dedent(
20 """\
21 import pytest
22 from pytest_bdd import given, then, scenario
23
24 @scenario("given.feature", "Test given fixture injection")
25 def test_given():
26 pass
27
28 @given("I have injecting given", target_fixture="foo")
29 def _():
30 return "injected foo"
31
32
33 @then('foo should be "injected foo"')
34 def _(foo):
35 assert foo == "injected foo"
36
37 """
38 )
39 )
40 result = pytester.runpytest()
41 result.assert_outcomes(passed=1)

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…