Skip to content

Xfail does not work with condition keyword argument.  #1496

@astraw38

Description

@astraw38

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions