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

Function test_generate_missing

tests/generation/test_generate_missing.py:18–85  ·  view source on GitHub ↗

Test generate missing command.

(pytester)

Source from the content-addressed store, hash-verified

16
17
18def test_generate_missing(pytester):
19 """Test generate missing command."""
20 pytester.makefile(
21 ".feature",
22 generation=textwrap.dedent(
23 """\
24 Feature: Missing code generation
25
26 Background:
27 Given I have a foobar
28
29 Scenario: Scenario tests which are already bound to the tests stay as is
30 Given I have a bar
31
32
33 Scenario: Code is generated for scenarios which are not bound to any tests
34 Given I have a bar
35
36
37 Scenario: Code is generated for scenario steps which are not yet defined(implemented)
38 Given I have a custom bar
39 """
40 ),
41 )
42
43 pytester.makepyfile(
44 textwrap.dedent(
45 """\
46 import functools
47
48 from pytest_bdd import scenario, given
49
50 scenario = functools.partial(scenario, "generation.feature")
51
52 @given("I have a bar")
53 def _():
54 return "bar"
55
56 @scenario("Scenario tests which are already bound to the tests stay as is")
57 def test_foo():
58 pass
59
60 @scenario("Code is generated for scenario steps which are not yet defined(implemented)")
61 def test_missing_steps():
62 pass
63 """
64 )
65 )
66
67 result = pytester.runpytest("--generate-missing", "--feature", "generation.feature")
68 result.assert_outcomes(passed=0, failed=0, errors=0)
69 assert not result.stderr.str()
70 assert result.ret == 0
71
72 result.stdout.fnmatch_lines(
73 ['Scenario "Code is generated for scenarios which are not bound to any tests" is not bound to any test *']
74 )
75

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…