pytest.xfail should work like pytest.mark.xfail
See original GitHub issuepytest.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
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:16 (8 by maintainers)
Top Results From Across the Web
How to use skip and xfail to deal with tests that cannot succeed
pytest counts and lists skip and xfail tests separately. ... The simplest way to skip a test function is to mark it with...
Read more >How and why I use pytest's xfail - Paul Ganssle
I would be inclined to instead add a custom pytest.mark.heavy test, and configure your test runner to skip things that are marked as...
Read more >Pytest - Xfail/Skip Tests - Tutorialspoint
In this chapter, we will learn about the Skip and Xfail tests in Pytest. Now, consider the below situations −. A test is...
Read more >@pytest.mark.xfail - pytest Quick Start Guide [Book] - O'Reilly
You can use @pytest.mark.xfail decorator to indicate that a test is expected to fail . As usual, we apply the mark decorator to...
Read more >marking a test as xfail with double parameterize in pytest
You could create a function that will be executed in tests collection time and handles the parametrization and the the xfail mark based...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for looking it up
I Strongly prefer the declarative way as it implies the Metadata is available after collection
This can be accomplished via the request fixture. I don’t know why
pytest.xfail
doesn’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.