From fab3c34412379598b812631e3c123e9467cdc485 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Tue, 20 Aug 2019 12:05:12 -0400 Subject: test: Print both messages on failure in assert_raises_message --- test/functional/test_framework/util.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'test') 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__) -- cgit v1.2.3