docs: document multiple positional conditions for skipif/xfail - #14802
Open
gleecode04 wants to merge 1 commit into
Open
docs: document multiple positional conditions for skipif/xfail#14802gleecode04 wants to merge 1 commit into
gleecode04 wants to merge 1 commit into
Conversation
pytest.mark.skipif and pytest.mark.xfail both accept multiple positional condition arguments (the test is skipped/xfailed if any evaluate to True), as already stated in the internal marker registration message and encoded in the type stubs. The reference docs only showed a single `condition` parameter and never mentioned this. Also add regression tests, since no test previously exercised multiple conditions passed to a single mark call (only stacking separate mark decorators was covered).
RonnyPfannschmidt
requested changes
Jul 30, 2026
RonnyPfannschmidt
left a comment
Member
There was a problem hiding this comment.
At first glance this makes everything worse
Both the test cases and the documentation changes add confusion to something that needs discussion first
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes the documented signatures for pytest.mark.skipif and pytest.mark.xfail to reflect the codebase: both accept multiple positional condition arguments, not just one, and the test is skipped/xfailed if any of them evaluate to True.
The behavior already existed (evaluate_skip_marks/evaluate_xfail_marks in src/_pytest/skipping.py loop over mark.args), it just wasn't documented, and no existing test called either mark with more than one positional condition in a single invocation, so I added regression tests for that in testing/test_skipping.py.
No changelog entry, per CONTRIBUTING.rst's exemption for doc-only fixes that don't change documented behavior.
I used AI assistance (Claude) to research this repo and prepare the change, then reviewed the diff, reproduced the behavior myself, and ran the full test_skipping.py suite plus a local docs build before opening this. Happy to answer questions on any part of it.