git: 6f0d113e7ed8 - stable/15 - atf_pytest: fix xfail detection from pytest report

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Tue, 30 Sep 2025 16:58:49 UTC
The branch stable/15 has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=6f0d113e7ed804a59ef3e9ff1040ea86882a8391

commit 6f0d113e7ed804a59ef3e9ff1040ea86882a8391
Author:     Siva Mahadevan <me@svmhdvn.name>
AuthorDate: 2025-09-17 20:34:58 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2025-09-30 16:58:15 +0000

    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
    (cherry picked from commit df997faca8411bdf8008c25de5db3ed719019d21)
---
 tests/atf_python/atf_pytest.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/atf_python/atf_pytest.py b/tests/atf_python/atf_pytest.py
index 19b5f88fa200..02ed502ace67 100644
--- a/tests/atf_python/atf_pytest.py
+++ b/tests/atf_python/atf_pytest.py
@@ -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"