mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-03 12:11:52 +02:00
Merge bitcoin/bitcoin#28035: test: Ignore UTF-8 errors in assert_debug_log
fa3d72960b
lint: Ignore check_fileopens failure on **kwargs (MarcoFalke)fa6bb85cd2
test: Ignore UTF-8 errors in assert_debug_log (MarcoFalke)fa63326fbc
test: Fix debug_log_size helper (MarcoFalke) Pull request description: Fix two bugs, see commit messages. ACKs for top commit: theStack: utACKfa3d72960b
Tree-SHA512: 4a29bdf954bf62bb7676c2a41b03ad017bc86d535b2bd912c96bd41d1621beb06d840b53c211480ad51974e8b293bbae620060d2528d269159f32c0b44e47712
This commit is contained in:
@ -424,8 +424,8 @@ class TestNode():
|
||||
def wallets_path(self) -> Path:
|
||||
return self.chain_path / "wallets"
|
||||
|
||||
def debug_log_bytes(self) -> int:
|
||||
with open(self.debug_log_path, encoding='utf-8') as dl:
|
||||
def debug_log_size(self, **kwargs) -> int:
|
||||
with open(self.debug_log_path, **kwargs) as dl:
|
||||
dl.seek(0, 2)
|
||||
return dl.tell()
|
||||
|
||||
@ -434,13 +434,13 @@ class TestNode():
|
||||
if unexpected_msgs is None:
|
||||
unexpected_msgs = []
|
||||
time_end = time.time() + timeout * self.timeout_factor
|
||||
prev_size = self.debug_log_bytes()
|
||||
prev_size = self.debug_log_size(encoding="utf-8") # Must use same encoding that is used to read() below
|
||||
|
||||
yield
|
||||
|
||||
while True:
|
||||
found = True
|
||||
with open(self.debug_log_path, encoding='utf-8') as dl:
|
||||
with open(self.debug_log_path, encoding="utf-8", errors="replace") as dl:
|
||||
dl.seek(prev_size)
|
||||
log = dl.read()
|
||||
print_log = " - " + "\n - ".join(log.splitlines())
|
||||
@ -465,7 +465,7 @@ class TestNode():
|
||||
the number of log lines we encountered when matching
|
||||
"""
|
||||
time_end = time.time() + timeout * self.timeout_factor
|
||||
prev_size = self.debug_log_bytes()
|
||||
prev_size = self.debug_log_size(mode="rb") # Must use same mode that is used to read() below
|
||||
|
||||
yield
|
||||
|
||||
|
Reference in New Issue
Block a user