Skip to content

skipif mark from parametrize hides module level skipif mark #1540

Closed
@adler-j

Description

@adler-j

Using pytestmark in combination with fixtures that has a skip causes the pytestmark to be ignored.

MWE:

import pytest

pytestmark = pytest.mark.skipif(True, reason='skip all')

# skipifs inside fixture params
params = [pytest.mark.skipif(False, reason='dont skip')('parameter')]


@pytest.fixture(params=params)
def parameter(request):
    return request.param


def test_1(parameter):
    assert True

returns:

user$ py.test -v
======================================== test session starts =========================================
platform linux2 -- Python 2.7.6, pytest-2.8.3, py-1.4.31, pluggy-0.3.1 -- /usr/bin/python
cachedir: .cache
rootdir: xxx, inifile: 
plugins: cov-2.2.0, pep8-1.0.6
collected 1 items 

example_test.py::test_1[parameter] PASSED

====================================== 1 passed in 0.00 seconds ======================================

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: marksrelated to marks, either the general marks or builtintopic: parametrizerelated to @pytest.mark.parametrizetype: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions