New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skipif mark from parametrize hides module level skipif mark #1540

Closed
adler-j opened this Issue Apr 28, 2016 · 7 comments

Comments

Projects
2 participants
@adler-j

adler-j commented Apr 28, 2016

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 ======================================
@RonnyPfannschmidt

This comment has been minimized.

Member

RonnyPfannschmidt commented Apr 28, 2016

i'm not sure if we already added support for obtaining mark from parameters that come via fixtures

can you verify against the 2.9 series?

@adler-j

This comment has been minimized.

adler-j commented Apr 28, 2016

Still happens with pytest 2.9:

======================================== test session starts =========================================
platform linux2 -- Python 2.7.6, pytest-2.9.1, 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 ======================================

@RonnyPfannschmidt RonnyPfannschmidt changed the title from fixture skips causes ignore on pytestmark to skipif mark from parametrize hides module level skipif mark Apr 28, 2016

@RonnyPfannschmidt

This comment has been minimized.

Member

RonnyPfannschmidt commented Apr 28, 2016

after analysis this one has to be solved after landing #1534

RonnyPfannschmidt added a commit to RonnyPfannschmidt/pytest that referenced this issue Apr 28, 2016

RonnyPfannschmidt added a commit to RonnyPfannschmidt/pytest that referenced this issue Apr 28, 2016

RonnyPfannschmidt added a commit that referenced this issue May 19, 2016

@RonnyPfannschmidt RonnyPfannschmidt moved this from todo to triage in resolve the mark fallout Jun 23, 2017

@RonnyPfannschmidt RonnyPfannschmidt moved this from triage to todo in resolve the mark fallout Jun 23, 2017

@RonnyPfannschmidt

This comment has been minimized.

Member

RonnyPfannschmidt commented Jun 23, 2017

this requires #2522

@RonnyPfannschmidt

This comment has been minimized.

Member

RonnyPfannschmidt commented Aug 9, 2017

#2672 will be the first step to fixing this

currently marks from parametrize just override other marks, and thats wrong

@RonnyPfannschmidt

This comment has been minimized.

Member

RonnyPfannschmidt commented Apr 10, 2018

fixed in #3317

@RonnyPfannschmidt RonnyPfannschmidt moved this from in progress to done in resolve the mark fallout Apr 10, 2018

@adler-j

This comment has been minimized.

adler-j commented Apr 10, 2018

Thank you so much for fixing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment