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

Closed
astraw38 opened this issue Mar 30, 2016 · 2 comments
Closed

Xfail does not work with condition keyword argument. #1496

astraw38 opened this issue Mar 30, 2016 · 2 comments
Labels
type: bug problem that needs to be addressed

Comments

@astraw38
Copy link

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
@nicoddemus nicoddemus added the type: bug problem that needs to be addressed label Mar 30, 2016
@nicoddemus
Copy link
Member

Thanks for the report!

@tomviner
Copy link
Contributor

PR for this issue: #1524

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

3 participants