Skip to content

Commit

Permalink
Add test to ensure steps not left-aligned are handled properly
Browse files Browse the repository at this point in the history
  • Loading branch information
jsa34 committed Sep 26, 2024
1 parent 0d42885 commit 04a1f6f
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/feature/test_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,3 +620,38 @@ def _(stuff):
"*Tearing down...*",
]
)


def test_right_aligned_steps(pytester):
"""Using the same given fixture raises an error."""
pytester.makefile(
".feature",
right_aligned_steps=textwrap.dedent(
"""\
Feature: Non-standard step indentation
Scenario: Indent my steps
Given I indent with 4 spaces
Then I indent with 5 spaces to line up
"""
),
)
pytester.makepyfile(
textwrap.dedent(
"""\
from pytest_bdd import given, then, scenarios
scenarios("right_aligned_steps.feature")
@given("I indent with 4 spaces")
def _():
pass
@then("I indent with 5 spaces to line up")
def _():
pass
"""
)
)
result = pytester.runpytest()
result.assert_outcomes(passed=1, failed=0)

0 comments on commit 04a1f6f

Please sign in to comment.