Skip to content

Commit 86f4ee1

Browse files
authored
Merge pull request #706 from jsa34/multiline-tags
2 parents 42f59ef + 4821898 commit 86f4ee1

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

CHANGES.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Unreleased
1212
- Multiline steps must now always use triple-quotes for the additional lines.
1313
- All feature files must now use the keyword `Feature:` to be considered valid.
1414
- Tags can no longer have spaces (e.g. "@tag one" "@tag two" are no longer valid).
15+
- Tags can now be on multiple lines (stacked)
1516

1617
7.3.0
1718
----------

tests/feature/test_tags.py

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
import textwrap
44

5-
import pytest
6-
75

86
def test_tags_selector(pytester):
97
"""Test tests selection by tags."""
@@ -191,3 +189,40 @@ def _():
191189
strict_option = "--strict-markers"
192190
result = pytester.runpytest_subprocess(strict_option)
193191
result.stdout.fnmatch_lines(["*= 2 passed * =*"])
192+
193+
194+
def test_multiline_tags(pytester):
195+
pytester.makefile(
196+
".feature",
197+
test="""
198+
Feature: Scenario with tags over multiple lines
199+
200+
@tag1
201+
@tag2
202+
Scenario: Tags
203+
Given I have a foo
204+
205+
Scenario: Second
206+
Given I have a baz
207+
""",
208+
)
209+
pytester.makepyfile(
210+
"""
211+
from pytest_bdd import given, scenarios
212+
213+
@given('I have a foo')
214+
def _():
215+
pass
216+
217+
@given('I have a baz')
218+
def _():
219+
pass
220+
221+
scenarios('test.feature')
222+
"""
223+
)
224+
result = pytester.runpytest("-m", "tag1", "-vv")
225+
result.assert_outcomes(passed=1, deselected=1)
226+
227+
result = pytester.runpytest("-m", "tag2", "-vv")
228+
result.assert_outcomes(passed=1, deselected=1)

0 commit comments

Comments
 (0)