[elbe-devel] [PATCH 02/14] tests: report each subtest

Thomas Weißschuh thomas.weissschuh at linutronix.de
Wed Feb 28 11:34:53 CET 2024


Make it easier to investigate failed subtests.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/commands/test.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/elbepack/commands/test.py b/elbepack/commands/test.py
index a5a22a10a2f4..c98db6d4373c 100644
--- a/elbepack/commands/test.py
+++ b/elbepack/commands/test.py
@@ -130,12 +130,22 @@ class ElbeTestSuite:
             print(test)
 
 
+class ElbeJUnitXmlResult(junit.JUnitXmlResult):
+    def addSubTest(self, test, subtest, error):
+        super().addSubTest(test, subtest, error)
+
+        if error is None:
+            self.addSuccess(subtest)
+        else:
+            self.addError(subtest, error)
+
+
 class ElbeTestResult(unittest.TestResult):
 
     def __init__(self):
         super().__init__()
         self.buffer = io.StringIO()
-        self.result = junit.JUnitXmlResult(self.buffer)
+        self.result = ElbeJUnitXmlResult(self.buffer)
         self.success = False
 
     def run_testsuite(self, suite):
-- 
2.44.0



More information about the elbe-devel mailing list