aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/util.py
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2019-08-20 12:05:12 -0400
committerMarcoFalke <falke.marco@gmail.com>2019-09-03 14:10:58 -0400
commitfab3c34412379598b812631e3c123e9467cdc485 (patch)
tree58114ec8ca9ea80333ceb360c25293c85c8d5a5e /test/functional/test_framework/util.py
parentfaa13539d5262bb7a512e9ff82e80083e04315ee (diff)
downloadbitcoin-fab3c34412379598b812631e3c123e9467cdc485.tar.xz
test: Print both messages on failure in assert_raises_message
Diffstat (limited to 'test/functional/test_framework/util.py')
-rw-r--r--test/functional/test_framework/util.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py
index 821e1cd3c5..6d74447ada 100644
--- a/test/functional/test_framework/util.py
+++ b/test/functional/test_framework/util.py
@@ -56,7 +56,9 @@ def assert_raises_message(exc, message, fun, *args, **kwds):
raise AssertionError("Use assert_raises_rpc_error() to test RPC failures")
except exc as e:
if message is not None and message not in e.error['message']:
- raise AssertionError("Expected substring not found:" + e.error['message'])
+ raise AssertionError(
+ "Expected substring not found in error message:\nsubstring: '{}'\nerror message: '{}'.".format(
+ message, e.error['message']))
except Exception as e:
raise AssertionError("Unexpected exception raised: " + type(e).__name__)
else:
@@ -116,7 +118,9 @@ def try_rpc(code, message, fun, *args, **kwds):
if (code is not None) and (code != e.error["code"]):
raise AssertionError("Unexpected JSONRPC error code %i" % e.error["code"])
if (message is not None) and (message not in e.error['message']):
- raise AssertionError("Expected substring not found:" + e.error['message'])
+ raise AssertionError(
+ "Expected substring not found in error message:\nsubstring: '{}'\nerror message: '{}'.".format(
+ message, e.error['message']))
return True
except Exception as e:
raise AssertionError("Unexpected exception raised: " + type(e).__name__)