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

xfailed test that fails during finalizer is reported twice #5164

Closed
christopherhw opened this issue Apr 24, 2019 · 1 comment
Closed

xfailed test that fails during finalizer is reported twice #5164

christopherhw opened this issue Apr 24, 2019 · 1 comment
Labels
topic: fixtures anything involving fixtures directly or indirectly topic: marks related to marks, either the general marks or builtin type: bug problem that needs to be addressed

Comments

@christopherhw
Copy link

christopherhw commented Apr 24, 2019

If a that is xfailed fails during a finalizer the test is reported twice. It's reported as skipped and an error. This also results in pytests exit code being 1 in an otherwise successful run.

If a test fails during a finalizer and it's xfailed it should probably only be reported as skipped.

I'm using pytest 3.3.2 on Ubuntu 18.04.1.

The following example should reproduce the problem:

import pytest
  
@pytest.fixture
def will_fail(request):
    def fin():
        assert False, "Finalizer failed."
    request.addfinalizer(fin)

@pytest.mark.usefixtures('will_fail')
def test_example():
    pytest.xfail("This test is xfailed.")
@Zac-HD Zac-HD added topic: fixtures anything involving fixtures directly or indirectly topic: marks related to marks, either the general marks or builtin type: bug problem that needs to be addressed labels Jun 5, 2019
@bluetech
Copy link
Member

Closing as duplicate of #9909

@bluetech bluetech closed this as not planned Won't fix, can't repro, duplicate, stale Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: fixtures anything involving fixtures directly or indirectly topic: marks related to marks, either the general marks or builtin type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

3 participants