MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / assert_debug_log

Method assert_debug_log

test/functional/test_framework/test_node.py:250–264  ·  view source on GitHub ↗
(self, expected_msgs)

Source from the content-addressed store, hash-verified

248
249 @contextlib.contextmanager
250 def assert_debug_log(self, expected_msgs):
251 debug_log = os.path.join(self.datadir, 'regtest', 'debug.log')
252 with open(debug_log, encoding='utf-8') as dl:
253 dl.seek(0, 2)
254 prev_size = dl.tell()
255 try:
256 yield
257 finally:
258 with open(debug_log, encoding='utf-8') as dl:
259 dl.seek(prev_size)
260 log = dl.read()
261 print_log = " - " + "\n - ".join(log.splitlines())
262 for expected_msg in expected_msgs:
263 if re.search(re.escape(expected_msg), log, flags=re.MULTILINE) is None:
264 self._raise_assertion_error('Expected message "{}" does not partially match log:\n\n{}\n\n'.format(expected_msg, print_log))
265
266 def assert_start_raises_init_error(self, extra_args=None, expected_msg=None, match=ErrorMatch.FULL_TEXT, *args, **kwargs):
267 """Attempt to start the node and expect it to raise an error.

Callers 1

run_testMethod · 0.80

Calls 5

joinMethod · 0.80
formatMethod · 0.80
seekMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected