mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 07:39:08 +01:00
qa: assert_raises_message() - Stop assuming certain structure for exceptions
This commit is contained in:
@@ -101,10 +101,9 @@ def assert_raises_message(exc, message, fun, *args, **kwds):
|
||||
except JSONRPCException:
|
||||
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 in error message:\nsubstring: '{}'\nerror message: '{}'.".format(
|
||||
message, e.error['message']))
|
||||
if message is not None and message not in repr(e):
|
||||
raise AssertionError("Expected substring not found in exception:\n"
|
||||
f"substring: '{message}'\nexception: {repr(e)}.")
|
||||
except Exception as e:
|
||||
raise AssertionError("Unexpected exception raised: " + type(e).__name__)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user