pytest-bdd icon indicating copy to clipboard operation
pytest-bdd copied to clipboard

Multiple lines with tags override previous lines

Open The-Compiler opened this issue 9 years ago • 1 comments
trafficstars

When I have foo.feature:

Feature: Test

    @tag1
    @tag2
    Scenario: Test
        When foo
        Then bar

and foo.py:

from pytest_bdd import scenarios, when, then

@when('foo')
def when_foo():
    pass

@then('bar')
def then_bar():
    pass

scenarios('foo.feature')

I'd expect the scenario to be tagged with both tag1 and tag2 - however, the second tag line just overrides the first:

$ py.test foo.py -ktag1
=============== test session starts ===============
platform linux -- Python 3.5.2, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
rootdir: /home/florian/bdd, inifile: 
plugins: bdd-2.17.0
collected 1 items 

========= 1 tests deselected by '-ktag1' ==========
========== 1 deselected in 0.02 seconds ===========
$ py.test foo.py -ktag2
=============== test session starts ===============
platform linux -- Python 3.5.2, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
rootdir: /home/florian/bdd, inifile: 
plugins: bdd-2.17.0
collected 1 items 

foo.py .

============ 1 passed in 0.02 seconds =============

The-Compiler avatar Aug 19 '16 10:08 The-Compiler

write both tags on the same line

arthuRHD avatar Oct 22 '21 12:10 arthuRHD