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]>
Tested-by: Andrew Bailey <[email protected]>
Reviewed-by: Andrew Bailey <[email protected]>
---
 dts/framework/test_result.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/dts/framework/test_result.py b/dts/framework/test_result.py
index c6bddc55a9..21faa55dc1 100644
--- a/dts/framework/test_result.py
+++ b/dts/framework/test_result.py
@@ -45,11 +45,11 @@
 class Result(IntEnum):
     """The possible states that a setup, a teardown or a test case may end up 
in."""
 
-    #:
-    PASS = auto()
     #:
     SKIP = auto()
     #:
+    PASS = auto()
+    #:
     BLOCK = auto()
     #:
     FAIL = auto()
@@ -195,8 +195,15 @@ def extract_result(value: ResultNode | ResultLeaf) -> 
ResultLeaf:
                 case ResultLeaf():
                     return value
 
+        # Filter out setup/teardown steps
+        results = [
+            extract_result(child)
+            for child in self.children
+            if not (isinstance(child, ResultNode) and child.label in 
self.__ignore_steps)
+        ]
+
         return max(
-            (extract_result(child) for child in self.children),
+            results,
             default=ResultLeaf(result=Result.PASS),
         )
 
-- 
2.52.0

Reply via email to