diff options
author | fanquake <fanquake@gmail.com> | 2023-07-26 09:19:43 +0100 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2023-07-26 09:35:51 +0100 |
commit | 54fe963a53f8a5c0bbaebcd9b146d3a37a35d6d6 (patch) | |
tree | 1c06a8102f0a14829e17cb3c5cc78f793e6cd211 /test | |
parent | 32c15237b656209b932c5d6d2e20736c0e3d5a34 (diff) | |
parent | fa3d72960bc86319aa8b838e3df4e833f845c71f (diff) | |
download | bitcoin-54fe963a53f8a5c0bbaebcd9b146d3a37a35d6d6.tar.xz |
Merge bitcoin/bitcoin#28035: test: Ignore UTF-8 errors in assert_debug_log
fa3d72960bc86319aa8b838e3df4e833f845c71f lint: Ignore check_fileopens failure on **kwargs (MarcoFalke)
fa6bb85cd264adf2e1f0c71fa97b650f9a62745f test: Ignore UTF-8 errors in assert_debug_log (MarcoFalke)
fa63326fbc1634ef2816f79c54db9266e56f4b3b test: Fix debug_log_size helper (MarcoFalke)
Pull request description:
Fix two bugs, see commit messages.
ACKs for top commit:
theStack:
utACK fa3d72960bc86319aa8b838e3df4e833f845c71f
Tree-SHA512: 4a29bdf954bf62bb7676c2a41b03ad017bc86d535b2bd912c96bd41d1621beb06d840b53c211480ad51974e8b293bbae620060d2528d269159f32c0b44e47712
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/test_framework/test_node.py | 10 | ||||
-rwxr-xr-x | test/lint/lint-python-utf8-encoding.py | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py index 1fcef6ce1c..0615a430fd 100755 --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -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 diff --git a/test/lint/lint-python-utf8-encoding.py b/test/lint/lint-python-utf8-encoding.py index 64d04bff57..8c9266470f 100755 --- a/test/lint/lint-python-utf8-encoding.py +++ b/test/lint/lint-python-utf8-encoding.py @@ -28,7 +28,7 @@ def check_fileopens(): if e.returncode > 1: raise e - filtered_fileopens = [fileopen for fileopen in fileopens if not re.search(r"encoding=.(ascii|utf8|utf-8).|open\([^,]*, ['\"][^'\"]*b[^'\"]*['\"]", fileopen)] + filtered_fileopens = [fileopen for fileopen in fileopens if not re.search(r"encoding=.(ascii|utf8|utf-8).|open\([^,]*, (\*\*kwargs|['\"][^'\"]*b[^'\"]*['\"])", fileopen)] return filtered_fileopens |