Skip to content

Commit d0d2ce3

Browse files
authored
Merge pull request #705 from jsa34/non-left-aligned-steps
Add test to ensure steps not left-aligned are handled properly
2 parents 0d42885 + 0ff18ed commit d0d2ce3

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/feature/test_steps.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,3 +620,36 @@ def _(stuff):
620620
"*Tearing down...*",
621621
]
622622
)
623+
624+
625+
def test_right_aligned_steps(pytester):
626+
"""Parser correctly handles steps that are not left-aligned"""
627+
pytester.makefile(
628+
".feature",
629+
right_aligned_steps="""\
630+
Feature: Non-standard step indentation
631+
Scenario: Indent my steps
632+
Given I indent with 4 spaces
633+
Then I indent with 5 spaces to line up
634+
""",
635+
)
636+
pytester.makepyfile(
637+
textwrap.dedent(
638+
"""\
639+
from pytest_bdd import given, then, scenarios
640+
641+
scenarios("right_aligned_steps.feature")
642+
643+
@given("I indent with 4 spaces")
644+
def _():
645+
pass
646+
647+
@then("I indent with 5 spaces to line up")
648+
def _():
649+
pass
650+
651+
"""
652+
)
653+
)
654+
result = pytester.runpytest()
655+
result.assert_outcomes(passed=1, failed=0)

0 commit comments

Comments
 (0)