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

check doesn't respect runxfail option #171

Open
taylermulligan opened this issue Dec 10, 2024 · 0 comments · May be fixed by #172
Open

check doesn't respect runxfail option #171

taylermulligan opened this issue Dec 10, 2024 · 0 comments · May be fixed by #172

Comments

@taylermulligan
Copy link

When runxfail option is set (pytest --runxfail ...) tests that use check are reported as xfail instead of failed:

xfail_test.py

import pytest

@pytest.mark.xfail(reason="foo")
def test_xfail(check):
    with check:  # with this line gone, this is actual behaviour
        assert False

Expected behaviour

$ pytest --runxfail xfail_test.py 
================================================================ test session starts =================================================================
platform linux -- Python 3.10.12, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/taylermulligan/pytest_xfail
plugins: check-2.4.1
collected 1 item                                                                                                                                     

xfail_test.py F                                                                                                                                [100%]

====================================================================== FAILURES ======================================================================
_____________________________________________________________________ test_xfail _____________________________________________________________________

check = <pytest_check.context_manager.CheckContextManager object at 0x7f2db410d120>

    @pytest.mark.xfail(reason="foo")
    def test_xfail(check):
>       assert False
E       assert False

xfail_test.py:5: AssertionError
============================================================== short test summary info ===============================================================
FAILED xfail_test.py::test_xfail - assert False
================================================================= 1 failed in 0.01s ==================================================================

Actual behaviour

$ pytest --runxfail xfail_test.py 
================================================================ test session starts =================================================================
platform linux -- Python 3.10.12, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/taylermulligan/pytest_xfail
plugins: check-2.4.1
collected 1 item                                                                                                                                     

xfail_test.py x                                                                                                                                [100%]

================================================================= 1 xfailed in 0.03s =================================================================
@taylermulligan taylermulligan linked a pull request Dec 10, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant