pytest-dev / pytest-bdd

BDD library for the py.test runner
https://pytest-bdd.readthedocs.io/en/latest/
MIT License
1.27k stars 213 forks source link

Multiple lines with tags override previous lines #194

Open The-Compiler opened 7 years ago

The-Compiler commented 7 years ago

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 =============
arthuRHD commented 2 years ago

write both tags on the same line