mirror of
https://git.deluge-torrent.org/deluge
synced 2025-04-20 19:44:52 +00:00
[Tests] Fixes to improve terminal output from unit tests
Add __str__ to WrappedException so that the stacktrace is printed when a unit test raises a WrappedException. Change the log output from error to warning in DelugeRPCProtocol.dispatch when sending back a raised exception on an RPC request.
This commit is contained in:
parent
374989a2ad
commit
cae8a18437
3 changed files with 7 additions and 4 deletions
|
@ -215,9 +215,9 @@ class DelugeRPCProtocol(DelugeTransferProtocol):
|
|||
))
|
||||
except AttributeError:
|
||||
# This is not a deluge exception (object has no attribute '_args), let's wrap it
|
||||
log.error("An exception occurred while sending RPC_ERROR to "
|
||||
"client. Wrapping it and resending. Error to "
|
||||
"send(causing exception goes next):\n%s", formated_tb)
|
||||
log.warning("An exception occurred while sending RPC_ERROR to "
|
||||
"client. Wrapping it and resending. Error to "
|
||||
"send(causing exception goes next):\n%s", formated_tb)
|
||||
try:
|
||||
raise WrappedException(str(exceptionValue), exceptionType.__name__, formated_tb)
|
||||
except WrappedException:
|
||||
|
|
|
@ -43,6 +43,9 @@ class WrappedException(DelugeError):
|
|||
self.type = exception_type
|
||||
self.traceback = traceback
|
||||
|
||||
def __str__(self):
|
||||
return "%s\n%s" % (self.message, self.traceback)
|
||||
|
||||
|
||||
class _ClientSideRecreateError(DelugeError):
|
||||
pass
|
||||
|
|
|
@ -16,7 +16,7 @@ class BaseTestCase(unittest.TestCase):
|
|||
def setUp(self): # NOQA
|
||||
|
||||
if len(component._ComponentRegistry.components) != 0:
|
||||
warnings.warn("The component._ComponentRegistry.components is not empty on test setup."
|
||||
warnings.warn("The component._ComponentRegistry.components is not empty on test setup.\n"
|
||||
"This is probably caused by another test that didn't clean up after finishing!: %s" %
|
||||
component._ComponentRegistry.components)
|
||||
d = maybeDeferred(self.set_up)
|
||||
|
|
Loading…
Add table
Reference in a new issue