Skip to content

Commit

Permalink
Merge pull request #706 from jsa34/multiline-tags
Browse files Browse the repository at this point in the history
  • Loading branch information
youtux authored Oct 1, 2024
2 parents 42f59ef + 4821898 commit 86f4ee1
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Unreleased
- Multiline steps must now always use triple-quotes for the additional lines.
- All feature files must now use the keyword `Feature:` to be considered valid.
- Tags can no longer have spaces (e.g. "@tag one" "@tag two" are no longer valid).
- Tags can now be on multiple lines (stacked)

7.3.0
----------
Expand Down
39 changes: 37 additions & 2 deletions tests/feature/test_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import textwrap

import pytest


def test_tags_selector(pytester):
"""Test tests selection by tags."""
Expand Down Expand Up @@ -191,3 +189,40 @@ def _():
strict_option = "--strict-markers"
result = pytester.runpytest_subprocess(strict_option)
result.stdout.fnmatch_lines(["*= 2 passed * =*"])


def test_multiline_tags(pytester):
pytester.makefile(
".feature",
test="""
Feature: Scenario with tags over multiple lines
@tag1
@tag2
Scenario: Tags
Given I have a foo
Scenario: Second
Given I have a baz
""",
)
pytester.makepyfile(
"""
from pytest_bdd import given, scenarios
@given('I have a foo')
def _():
pass
@given('I have a baz')
def _():
pass
scenarios('test.feature')
"""
)
result = pytester.runpytest("-m", "tag1", "-vv")
result.assert_outcomes(passed=1, deselected=1)

result = pytester.runpytest("-m", "tag2", "-vv")
result.assert_outcomes(passed=1, deselected=1)

0 comments on commit 86f4ee1

Please sign in to comment.