Repository navigation
Fix missing failure details for strict XPASS in allure-pytest - #933
Open
nonatomiclabs wants to merge 2 commits into
Open
nonatomiclabs wants to merge 2 commits into
nonatomiclabs wants to merge 2 commits into
Conversation
Include pytest's strict XPASS message and reason in Allure status details when an xfailed test unexpectedly passes.
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.
Context
Pytest’s xfail marker identifies tests that are expected to fail, for instance because of a known bug. Pytest supports a "strict" xfail mode through
@pytest.mark.xfail(strict=True)or thexfail_strictconfiguration option. In this mode, an unexpectedly passing test (XPASS) is treated as a failure. This is useful to ensure that xfail markers are removed when a bug is fixed.Currently, allure-pytest reports these tests as Failed, but provides no failure details, leaving out both the strict XPASS indication and the xfail reason.
This PR populates the failure details with pytest’s
[XPASS(strict)]message, including the reason when present. This follows the approach already used in allure-pytest-bdd (see the code and the "Xfail support" section in #845).Regression tests cover explicit and configured strict mode, with and without a reason, and verify that existing XFAIL and ordinary failure reporting remain unchanged.
Checklist
Verification
before:

after:
