Skip to content

Using @pytest.mark.skipif on a fixture silently fails. #964

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

Closed
The-Compiler opened this issue Aug 26, 2015 · 5 comments
Closed

Using @pytest.mark.skipif on a fixture silently fails. #964

The-Compiler opened this issue Aug 26, 2015 · 5 comments

Comments

@The-Compiler
Copy link
Member

Since pytest.skip(...) can be used inside a fixture, I'd've expected that @pytest.mark.skipif does as well - turns out it seems to do nothing:

import pytest

@pytest.fixture
@pytest.mark.skipif(True, reason='test')
def fixt():
    pass

def test_one(fixt):
    pass

def test_two(fixt):
    pass
test_foo.py ..

============= 2 passed in 0.01 seconds ==============
@RonnyPfannschmidt
Copy link
Member

marks on fixtures are not considered or taken into account

@nicoddemus
Copy link
Member

Perhaps it should be made explicit in the documentation about marks?

@RonnyPfannschmidt
Copy link
Member

good point

@nchammas
Copy link
Contributor

nchammas commented Nov 5, 2017

Is there any design reason we cannot expand skipif to apply to fixtures (and thus automatically apply to any downstream tests) as well? Is that what #1368 is about?

@RonnyPfannschmidt
Copy link
Member

its tricky, complicated, and impossible to implement correct on the current mark mechanism

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants