Skip to content

Commit 63f000a

Browse files
committed
Add test for making sure parsing feature files doesn't incorrectly pick up where keywords are not used in the case of a step.
1 parent 36c3fa4 commit 63f000a

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

tests/feature/test_steps.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,3 +653,42 @@ def _():
653653
)
654654
result = pytester.runpytest()
655655
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)

0 commit comments

Comments
 (0)