|
20 | 20 | import collections
|
21 | 21 | import shlex
|
22 | 22 | import sys
|
| 23 | +from pathlib import Path |
23 | 24 |
|
24 | 25 | from .authproxy import JSONRPCException
|
25 | 26 | from .descriptors import descsum_create
|
@@ -368,21 +369,28 @@ def is_node_stopped(self):
|
368 | 369 | def wait_until_stopped(self, timeout=BITCOIND_PROC_WAIT_TIMEOUT):
|
369 | 370 | wait_until_helper(self.is_node_stopped, timeout=timeout, timeout_factor=self.timeout_factor)
|
370 | 371 |
|
| 372 | + @property |
| 373 | + def chain_path(self) -> Path: |
| 374 | + return Path(self.datadir) / self.chain |
| 375 | + |
| 376 | + @property |
| 377 | + def debug_log_path(self) -> Path: |
| 378 | + return self.chain_path / 'debug.log' |
| 379 | + |
371 | 380 | @contextlib.contextmanager
|
372 | 381 | def assert_debug_log(self, expected_msgs, unexpected_msgs=None, timeout=2):
|
373 | 382 | if unexpected_msgs is None:
|
374 | 383 | unexpected_msgs = []
|
375 | 384 | time_end = time.time() + timeout * self.timeout_factor
|
376 |
| - debug_log = os.path.join(self.datadir, self.chain, 'debug.log') |
377 |
| - with open(debug_log, encoding='utf-8') as dl: |
| 385 | + with open(self.debug_log_path, encoding='utf-8') as dl: |
378 | 386 | dl.seek(0, 2)
|
379 | 387 | prev_size = dl.tell()
|
380 | 388 |
|
381 | 389 | yield
|
382 | 390 |
|
383 | 391 | while True:
|
384 | 392 | found = True
|
385 |
| - with open(debug_log, encoding='utf-8') as dl: |
| 393 | + with open(self.debug_log_path, encoding='utf-8') as dl: |
386 | 394 | dl.seek(prev_size)
|
387 | 395 | log = dl.read()
|
388 | 396 | print_log = " - " + "\n - ".join(log.splitlines())
|
|
0 commit comments