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 <me@svmhdvn.name>
Pull-request: https://github.com/freebsd/freebsd-src/pull/1849
Sponsored by: The FreeBSD Foundation
This commit is contained in:
Siva Mahadevan
2025-09-17 16:34:58 -04:00
committed by Ed Maste
parent 506b36c4fd
commit df997faca8
+2 -2
View File
@@ -256,7 +256,7 @@ def add_report(self, report):
# 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 @@ def add_report(self, report):
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"