(pytester)
| 4 | |
| 5 | |
| 6 | def 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) |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…