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

Is the 'raises' parameter in xfail ignored? #145

Open
doomofart opened this issue Oct 19, 2023 · 1 comment
Open

Is the 'raises' parameter in xfail ignored? #145

doomofart opened this issue Oct 19, 2023 · 1 comment

Comments

@doomofart
Copy link

Hi!

My test returns xfail, although the exception type is not that I specify in 'raises'.

e. g.

@pytest.mark.xfail(raises=ZeroDivisionError)
    def test_xfail(self):
        with check:
            assert 1 == 2

I am waiting 'failed', but the test returns 'xfailed'. I think I'm doing something wrong. Is there another way?

@okken
Copy link
Owner

okken commented Oct 31, 2023

Looks like we don't support raises yet.
Too bad though. It'd be nice to support that.

This could be considered an enhancement, but I realize it's unexpected behavior for you, so bug is also reasonable.

Adding some notes here, so I don't forget.

Perhaps we could interrogate the xfail args, like https://github.com/pytest-dev/pytest/blob/8fb7e8b31efaa55e760c142e26eb82b42081ca28/src/_pytest/skipping.py#L207

I'm hoping it's not too late to deal with the issue in make_report, here

def pytest_runtest_makereport(item, call):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants