Update overall result of test suites such that
when some cases skip and at least one passes,
the result is a pass instead of a skip. Only
when all cases skip is the result a skip.

Bugzilla ID: 1899

Signed-off-by: Dean Marx <[email protected]>
---
 dts/framework/test_result.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/dts/framework/test_result.py b/dts/framework/test_result.py
index c6bddc55a9..0a43c23c04 100644
--- a/dts/framework/test_result.py
+++ b/dts/framework/test_result.py
@@ -195,10 +195,11 @@ def extract_result(value: ResultNode | ResultLeaf) -> 
ResultLeaf:
                 case ResultLeaf():
                     return value
 
-        return max(
-            (extract_result(child) for child in self.children),
-            default=ResultLeaf(result=Result.PASS),
-        )
+        results = [extract_result(child) for child in self.children]
+        max_result = max(results, default=ResultLeaf(result=Result.PASS))
+        if max_result.result == Result.SKIP and any(r.result == Result.PASS 
for r in results):
+            return ResultLeaf(result=Result.PASS)
+        return max_result
 
     def make_summary(self) -> Counter[Result]:
         """Make the summary of the underlying results while ignoring special 
nodes."""
-- 
2.52.0

Reply via email to