Skip to content

Commit

Permalink
test: introduce TestNode.debug_log_bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesob committed Dec 29, 2021
1 parent 587cbca commit a2fb62b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/functional/test_framework/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,14 +389,17 @@ def chain_path(self) -> Path:
def debug_log_path(self) -> Path:
return self.chain_path / 'debug.log'

def debug_log_bytes(self) -> int:
with open(self.debug_log_path, encoding='utf-8') as dl:
dl.seek(0, 2)
return dl.tell()

@contextlib.contextmanager
def assert_debug_log(self, expected_msgs, unexpected_msgs=None, timeout=2):
if unexpected_msgs is None:
unexpected_msgs = []
time_end = time.time() + timeout * self.timeout_factor
with open(self.debug_log_path, encoding='utf-8') as dl:
dl.seek(0, 2)
prev_size = dl.tell()
prev_size = self.debug_log_bytes()

yield

Expand Down

0 comments on commit a2fb62b

Please sign in to comment.