File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -653,3 +653,42 @@ def _():
653
653
)
654
654
result = pytester .runpytest ()
655
655
result .assert_outcomes (passed = 1 , failed = 0 )
656
+
657
+
658
+ def test_keywords_used_outside_steps (pytester ):
659
+ """Correctly identify when keyword is used for steps and when it's used for other cases."""
660
+ pytester .makefile (
661
+ ".feature" ,
662
+ keywords = """\
663
+ Feature: Given this is a Description
664
+
665
+ In order to achieve something
666
+ I want something
667
+ Because it will be cool
668
+ Given it is valid description
669
+ When it starts working
670
+ Then I will be happy
671
+
672
+
673
+ Some description goes here.
674
+
675
+ Scenario: When I set a Description
676
+ Given I have a bar
677
+ """ ,
678
+ )
679
+ pytester .makepyfile (
680
+ textwrap .dedent (
681
+ """\
682
+ from pytest_bdd import given, scenarios
683
+
684
+ scenarios("keywords.feature")
685
+
686
+ @given("I have a bar")
687
+ def _():
688
+ pass
689
+
690
+ """
691
+ )
692
+ )
693
+ result = pytester .runpytest ()
694
+ result .assert_outcomes (passed = 1 , failed = 0 )
You can’t perform that action at this time.
0 commit comments