pytest: pytest.xfail should work like pytest.mark.xfail
pytest.xfail should do exactly what pytest.mark.xfail does. pytest.xfail acts like pytest.skip for no good reason. pytest.xfail should let the test run then mark it as XFAIL or XPASS.
The current pytest.xfail already exists as pytest.fail and new delayed pytest.xfail should developed in place.
https://github.com/pytest-dev/pytest/issues/7060 https://github.com/pytest-dev/pytest/issues/810
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 5
- Comments: 16 (8 by maintainers)
This can be accomplished via the request fixture. I don’t know why
pytest.xfaildoesn’t do the same, but I also don’t understand pytest internals. Minimal example:1 passes, 2 fails (xpass strict), 3 xfails, and 4 fails.
Thanks for looking it up
I Strongly prefer the declarative way as it implies the Metadata is available after collection