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

Xfail does not work with condition keyword argument. #1496

astraw38 opened this Issue Mar 30, 2016 · 2 comments


None yet
3 participants
Copy link

astraw38 commented Mar 30, 2016

In the docs, you provide a signature of the xfail marker:

def xfail(condition=None, *, reason=None, raises=None, run=True, strict=False):

However, trying to use the xfail marker with a condition keyword argument will cause it to always xfail the test, no matter the evaluation of the argument.

Quick example:

import pytest

@pytest.mark.xfail(condition=False, reason="this test should pass")
def test_xfail1():
     assert True

@pytest.mark.xfail(False, reason="this test actually passes")
def test_xfail2():
     assert True

This comment has been minimized.

Copy link

nicoddemus commented Mar 30, 2016

Thanks for the report!


This comment has been minimized.

Copy link

tomviner commented Apr 19, 2016

PR for this issue: #1524

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.