#NEWLINE# def test_generate_missing( testdir ) : #NEWLINE# #INDENT# 'Test generate missing command.' #NEWLINE# dirname = 'test_generate_missing' #NEWLINE# tests = testdir . mkpydir ( dirname ) #NEWLINE# with open ( os . path . join ( os . path . dirname ( __file__ ) , 'generation.feature' ) ) as fd : #NEWLINE# #INDENT# tests . join ( 'generation.feature' ) . write ( fd . read ( ) ) #NEWLINE# #UNINDENT# tests . join ( 'test_foo.py' ) . write ( py . code . Source ( '\n        import functools\n\n        from pytest_bdd import scenario, given\n\n        scenario = functools.partial(scenario, "generation.feature")\n\n        @given("I have a bar")\n        def i_have_a_bar():\n            return "bar"\n\n        @scenario("Scenario tests which are already bound to the tests stay as is")\n        def test_foo():\n            pass\n\n        @scenario("Code is generated for scenario steps which are not yet defined(implemented)")\n        def test_missing_steps():\n            pass\n    ' ) ) #NEWLINE# result = testdir . runpytest ( dirname , '--generate-missing' , '--feature' , tests . join ( 'generation.feature' ) . strpath ) #NEWLINE# result . stdout . fnmatch_lines ( [ 'Scenario "Code is generated for scenarios which are not bound to any tests" is not bound to any test *' ] ) #NEWLINE# result . stdout . fnmatch_lines ( [ 'Step Given "I have a custom bar" is not defined in the scenario "Code is generated for scenario steps which are not yet defined(implemented)" *' ] ) #NEWLINE# result . stdout . fnmatch_lines ( [ 'Step Given "I have a foobar" is not defined in the background of the feature "Missing code generation" *' ] ) #NEWLINE# result . stdout . fnmatch_lines ( [ 'Please place the code above to the test file(s):' ] )