Skip to content

skipif marker ignored in parametrized list (2.9.0-rc.1) #1412

@nicoddemus

Description

@nicoddemus

Consider this example:

import pytest, sys

@pytest.mark.parametrize('x', [
    0,
    1,
    pytest.mark.skipif('True')(2)
])
def testSkipIf(x):
    assert x < 2    

In 2.8.7 it works as expected, the last parameter is skipped:

] py.test -q foo.py
..s
2 passed, 1 skipped, 1 pytest-warnings in 0.01 seconds

In 2.9.0-rc.1 though the test executes anyway, ignoring the skipif marker:

] py.test -q foo.py
..F
================================== FAILURES ===================================
________________________________ testSkipIf[2] ________________________________

x = 2

    @pytest.mark.parametrize('x', [
        0,
        1,
        pytest.mark.skipif('True')(2)
    ])
    def testSkipIf(x):
>       assert x < 2
E       assert 2 < 2

foo.py:9: AssertionError
1 failed, 2 passed, 1 pytest-warnings in 0.02 seconds

Metadata

Metadata

Assignees

Labels

topic: parametrizerelated to @pytest.mark.parametrizetype: regressionindicates a problem that was introduced in a release which was working previously

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions