From 46e0c6e8aee9e276ebd037824cf6c52d9d39993b Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Mon, 12 Feb 2024 10:38:40 +0100 Subject: [PATCH] tests: print traceback of original exception when testcase fails --- electrum/tests/qt_util.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/electrum/tests/qt_util.py b/electrum/tests/qt_util.py index 3ea6a8a24..2ca802fe2 100644 --- a/electrum/tests/qt_util.py +++ b/electrum/tests/qt_util.py @@ -1,4 +1,5 @@ import threading +import traceback import unittest from functools import wraps, partial from unittest import SkipTest @@ -69,7 +70,7 @@ def qt_test(func): QMetaObject.invokeMethod(self.app, 'doInvoke', Qt.ConnectionType.QueuedConnection) self._event.wait(15) if self._e: - print(f'raising ex: {self._e!r}') + print("".join(traceback.format_exception(self._e))) # deallocate stored exception from qt thread otherwise we SEGV garbage collector # instead, re-create using the exception message, special casing AssertionError and SkipTest e = None