Skip to content

Commit 19a2e35

Browse files
regex test
1 parent e01a491 commit 19a2e35

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/functional/test_framework/test_node.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,10 +506,14 @@ def assert_debug_log(self, expected_msgs, unexpected_msgs=None, timeout=2, with_
506506
log = dl.read()
507507
print_log = " - " + "\n - ".join(log.splitlines())
508508
for unexpected_msg in unexpected_msgs:
509-
if re.search(unexpected_msg if with_regex else re.escape(unexpected_msg), log, flags=re.MULTILINE):
509+
if not with_regex:
510+
unexpected_msg = re.escape(unexpected_msg)
511+
if re.search(unexpected_msg, log, flags=re.MULTILINE):
510512
self._raise_assertion_error('Unexpected message "{}" partially matches log:\n\n{}\n\n'.format(unexpected_msg, print_log))
511513
for expected_msg in expected_msgs:
512-
if re.search(expected_msg if with_regex else re.escape(expected_msg), log, flags=re.MULTILINE) is None:
514+
if not with_regex:
515+
expected_msg = re.escape(expected_msg)
516+
if re.search(expected_msg, log, flags=re.MULTILINE) is None:
513517
found = False
514518
if found:
515519
return

0 commit comments

Comments
 (0)