aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/test_node.py
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2018-03-19 15:35:04 -0400
committerMarcoFalke <falke.marco@gmail.com>2018-03-19 15:49:35 -0400
commitfae137454adc50a4e1d448ed7219a8f5344486c9 (patch)
treeae5f891c71d820da5f57606b8380b9c2251d755d /test/functional/test_framework/test_node.py
parent58122736b53390a2013630e95ff760800af160e7 (diff)
downloadbitcoin-fae137454adc50a4e1d448ed7219a8f5344486c9.tar.xz
qa: Allow for partial_match when checking init error
This allows the tests to pass on different platforms
Diffstat (limited to 'test/functional/test_framework/test_node.py')
-rwxr-xr-xtest/functional/test_framework/test_node.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py
index 8d88069108..8d6ec618d5 100755
--- a/test/functional/test_framework/test_node.py
+++ b/test/functional/test_framework/test_node.py
@@ -166,7 +166,7 @@ class TestNode():
def wait_until_stopped(self, timeout=BITCOIND_PROC_WAIT_TIMEOUT):
wait_until(self.is_node_stopped, timeout=timeout)
- def assert_start_raises_init_error(self, extra_args=None, expected_msg=None, *args, **kwargs):
+ def assert_start_raises_init_error(self, extra_args=None, expected_msg=None, partial_match=False, *args, **kwargs):
"""Attempt to start the node and expect it to raise an error.
extra_args: extra arguments to pass through to bitcoind
@@ -187,9 +187,13 @@ class TestNode():
# Check stderr for expected message
if expected_msg is not None:
log_stderr.seek(0)
- stderr = log_stderr.read().decode('utf-8')
- if re.fullmatch(expected_msg + '\n', stderr) is None:
- raise AssertionError('Expected message "{}" does not match stderr:\n"{}"'.format(expected_msg, stderr))
+ stderr = log_stderr.read().decode('utf-8').strip()
+ if partial_match:
+ if re.search(expected_msg, stderr, flags=re.MULTILINE) is None:
+ raise AssertionError('Expected message "{}" does not partially match stderr:\n"{}"'.format(expected_msg, stderr))
+ else:
+ if re.fullmatch(expected_msg, stderr) is None:
+ raise AssertionError('Expected message "{}" does not fully match stderr:\n"{}"'.format(expected_msg, stderr))
else:
if expected_msg is None:
assert_msg = "bitcoind should have exited with an error"