aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiva Mahadevan <me@svmhdvn.name>2025-09-17 20:34:58 +0000
committerEd Maste <emaste@FreeBSD.org>2025-09-18 13:01:14 +0000
commitdf997faca8411bdf8008c25de5db3ed719019d21 (patch)
tree11819c79e37a29b739b33813afaa3bcd7b1cf22c
parent506b36c4fdde0b402cc730b41a9d9d20130e1bca (diff)
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
-rw-r--r--tests/atf_python/atf_pytest.py4
1 files 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"