Skip to content
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
Closed

skipif mark from parametrize hides module level skipif mark #1540

adler-j opened this issue Apr 28, 2016 · 7 comments
Labels
topic: marks related to marks, either the general marks or builtin topic: parametrize related to @pytest.mark.parametrize type: bug problem that needs to be addressed

Comments

@adler-j
Copy link

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
Copy link
Member

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
Copy link
Author

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 fixture skips causes ignore on pytestmark skipif mark from parametrize hides module level skipif mark Apr 28, 2016
@RonnyPfannschmidt RonnyPfannschmidt added type: bug problem that needs to be addressed topic: parametrize related to @pytest.mark.parametrize labels Apr 28, 2016
@RonnyPfannschmidt
Copy link
Member

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 RonnyPfannschmidt added the topic: marks related to marks, either the general marks or builtin label May 14, 2017
@RonnyPfannschmidt
Copy link
Member

this requires #2522

@RonnyPfannschmidt
Copy link
Member

#2672 will be the first step to fixing this

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

@RonnyPfannschmidt
Copy link
Member

fixed in #3317

@adler-j
Copy link
Author

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
Labels
topic: marks related to marks, either the general marks or builtin topic: parametrize related to @pytest.mark.parametrize type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

2 participants