You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix session fixture teardown exceptions being reported as duplicate XFAILs
When a session-scoped autouse fixture raises an exception during teardown,
and the last test in the suite is marked @pytest.mark.xfail, pytest was
incorrectly showing an extra XFAIL line (duplicated) instead of reporting
the teardown failure as an ERROR.
The root cause was that the xfail handling in pytest_runtest_makereport was
being applied to all phases (setup, call, teardown), converting any exception
into an xfail result if the test was marked with xfail. This meant that
session fixture teardown exceptions were being misreported as expected failures.
The fix restricts xfail handling to only apply during the "call" phase.
Setup and teardown failures are now properly reported as errors, regardless
of xfail markers on the test. This aligns with the principle that xfail
should only apply to test execution, not to fixture setup/teardown failures.
Fixes#8375
0 commit comments