From cccca8a77f3c1b22fb0ea825ca92aebd63b16d77 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Tue, 3 Dec 2024 09:40:47 +0100 Subject: [PATCH] test: Avoid logging error when logging error --- test/functional/test_framework/p2p.py | 6 +++--- test/lint/test_runner/src/main.rs | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/functional/test_framework/p2p.py b/test/functional/test_framework/p2p.py index a7d6c36e303e2..523e1bd0682ba 100755 --- a/test/functional/test_framework/p2p.py +++ b/test/functional/test_framework/p2p.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # Copyright (c) 2010 ArtForz -- public domain half-a-node # Copyright (c) 2012 Jeff Garzik -# Copyright (c) 2010-2022 The Bitcoin Core developers +# Copyright (c) 2010-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test objects for interacting with a bitcoind node over the p2p protocol. @@ -369,7 +369,7 @@ def _on_data(self): self.on_message(t) except Exception as e: if not self.reconnect: - logger.exception('Error reading message:', repr(e)) + logger.exception(f"Error reading message: {repr(e)}") raise def on_message(self, message): @@ -659,7 +659,7 @@ def wait_for_getheaders(self, block_hash=None, *, timeout=60): def test_function(): last_getheaders = self.last_message.pop("getheaders", None) if block_hash is None: - return last_getheaders + return last_getheaders if last_getheaders is None: return False return block_hash == last_getheaders.locator.vHave[0] diff --git a/test/lint/test_runner/src/main.rs b/test/lint/test_runner/src/main.rs index 42c880052ebd0..3cf0353936038 100644 --- a/test/lint/test_runner/src/main.rs +++ b/test/lint/test_runner/src/main.rs @@ -236,6 +236,7 @@ fn lint_py_lint() -> LintResult { "F822", // undefined name name in __all__ "F823", // local variable name … referenced before assignment "F841", // local variable 'foo' is assigned to but never used + "PLE", // Pylint errors "W191", // indentation contains tabs "W291", // trailing whitespace "W292", // no newline at end of file