Skip to content

Commit 04a1f6f

Browse files
committed
Add test to ensure steps not left-aligned are handled properly
1 parent 0d42885 commit 04a1f6f

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/feature/test_steps.py

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

0 commit comments

Comments
 (0)