atf_pytest: fix xfail detection from pytest report

The location of the 'wasxfail' attribute was moved from
the 'reason' attribute back to the parent 'report'. This
fixes an issue where xfails are wrongly reported to ATF
as skipped tests.

Signed-off-by: Siva Mahadevan <[email protected]>
Pull-request: https://github.com/freebsd/freebsd-src/pull/1849
Sponsored by: The FreeBSD Foundation
This commit is contained in:
Siva Mahadevan authored and Ed Maste committed 2025-09-18 09:01:14 -04:00
1 parent 506b36c4fd
commit df997faca8
1 file changed
+2 -2
+2 -2
View File
@@ -256,7 +256,7 @@ class ATFHandler(object):
# Record failure & override "skipped" state
self.set_report_state(test_name, state, reason)
elif state == "skipped":
if hasattr(reason, "wasxfail"):
if hasattr(report, "wasxfail"):
# xfail() called in the test body
state = "expected_failure"
else:
@@ -264,7 +264,7 @@ class ATFHandler(object):
pass
self.set_report_state(test_name, state, reason)
elif state == "passed":
if hasattr(reason, "wasxfail"):
if hasattr(report, "wasxfail"):
# the test was expected to fail but didn't
# mark as hard failure
state = "failed"