[elbe-devel] [PATCH v2] test_xml: make sure the full traceback ends up in the test result

Christian Teklenborg chris at linutronix.de
Tue Jan 26 12:09:53 CET 2021


Before, only a CommandError with the executed command and an exit code was
captured and written to the test result if an error occured. Extend the test
result with the full traceback.

Signed-off-by: Christian Teklenborg <chris at linutronix.de>
---
 elbepack/tests/test_xml.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/elbepack/tests/test_xml.py b/elbepack/tests/test_xml.py
index 30d57dc7..48ac04f3 100644
--- a/elbepack/tests/test_xml.py
+++ b/elbepack/tests/test_xml.py
@@ -9,7 +9,12 @@ import tempfile
 
 from elbepack.directories import elbe_dir, elbe_exe
 from elbepack.commands.test import ElbeTestCase, ElbeTestLevel
-from elbepack.shellhelper import system
+from elbepack.shellhelper import command_out
+
+def system(cmd, allow_fail=False):
+    ret, out = command_out(cmd)
+    if ret != 0 and not allow_fail:
+        raise Exception(out)
 
 @unittest.skipIf(ElbeTestCase.level < ElbeTestLevel.INITVM,
                  "Test level not set to INITVM")
-- 
2.20.1



More information about the elbe-devel mailing list