mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-08 09:28:41 +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,7 +215,7 @@ class DelugeRPCProtocol(DelugeTransferProtocol):
|
||||||
))
|
))
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# This is not a deluge exception (object has no attribute '_args), let's wrap it
|
# 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 "
|
log.warning("An exception occurred while sending RPC_ERROR to "
|
||||||
"client. Wrapping it and resending. Error to "
|
"client. Wrapping it and resending. Error to "
|
||||||
"send(causing exception goes next):\n%s", formated_tb)
|
"send(causing exception goes next):\n%s", formated_tb)
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -43,6 +43,9 @@ class WrappedException(DelugeError):
|
||||||
self.type = exception_type
|
self.type = exception_type
|
||||||
self.traceback = traceback
|
self.traceback = traceback
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return "%s\n%s" % (self.message, self.traceback)
|
||||||
|
|
||||||
|
|
||||||
class _ClientSideRecreateError(DelugeError):
|
class _ClientSideRecreateError(DelugeError):
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -16,7 +16,7 @@ class BaseTestCase(unittest.TestCase):
|
||||||
def setUp(self): # NOQA
|
def setUp(self): # NOQA
|
||||||
|
|
||||||
if len(component._ComponentRegistry.components) != 0:
|
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" %
|
"This is probably caused by another test that didn't clean up after finishing!: %s" %
|
||||||
component._ComponentRegistry.components)
|
component._ComponentRegistry.components)
|
||||||
d = maybeDeferred(self.set_up)
|
d = maybeDeferred(self.set_up)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue