mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-09 11:27:28 -03:00
Merge bitcoin/bitcoin#31408: test: Avoid logging error when logging error
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / Win64 native fuzz, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / Win64 native fuzz, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
cccca8a77f
test: Avoid logging error when logging error (MarcoFalke) Pull request description: Currently a logging error in the form of `--- Logging error ---` happens when an error is logged in the `_on_data` helper. Fix it by properly logging the error. Also, treat pylint errors as errors, to avoid this problem in the future. Can be tested by running `p2p_addrv2_relay.py` with the following example diff: ```diff diff --git a/test/functional/test_framework/p2p.py b/test/functional/test_framework/p2p.py index 523e1bd068..0f1eb29d13 100755 --- a/test/functional/test_framework/p2p.py +++ b/test/functional/test_framework/p2p.py @@ -137,7 +137,7 @@ MESSAGEMAP = { b"notfound": msg_notfound, b"ping": msg_ping, b"pong": msg_pong, - b"sendaddrv2": msg_sendaddrv2, + #b"sendaddrv2": msg_sendaddrv2, b"sendcmpct": msg_sendcmpct, b"sendheaders": msg_sendheaders, b"sendtxrcncl": msg_sendtxrcncl, ACKs for top commit: fanquake: ACKcccca8a77f
Tree-SHA512: dd19f3feed0093246cb205903529fb9ebd5ad9a6c9330cfc5987c0154253c9dcec8d0e25ff99e4ac806a464ff58c3787a205378b8dfb7a1a521da25eac429136
This commit is contained in:
commit
6d973f86f7
2 changed files with 4 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# Copyright (c) 2010 ArtForz -- public domain half-a-node
|
# Copyright (c) 2010 ArtForz -- public domain half-a-node
|
||||||
# Copyright (c) 2012 Jeff Garzik
|
# 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
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
"""Test objects for interacting with a bitcoind node over the p2p protocol.
|
"""Test objects for interacting with a bitcoind node over the p2p protocol.
|
||||||
|
@ -369,7 +369,7 @@ class P2PConnection(asyncio.Protocol):
|
||||||
self.on_message(t)
|
self.on_message(t)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if not self.reconnect:
|
if not self.reconnect:
|
||||||
logger.exception('Error reading message:', repr(e))
|
logger.exception(f"Error reading message: {repr(e)}")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def on_message(self, message):
|
def on_message(self, message):
|
||||||
|
@ -659,7 +659,7 @@ class P2PInterface(P2PConnection):
|
||||||
def test_function():
|
def test_function():
|
||||||
last_getheaders = self.last_message.pop("getheaders", None)
|
last_getheaders = self.last_message.pop("getheaders", None)
|
||||||
if block_hash is None:
|
if block_hash is None:
|
||||||
return last_getheaders
|
return last_getheaders
|
||||||
if last_getheaders is None:
|
if last_getheaders is None:
|
||||||
return False
|
return False
|
||||||
return block_hash == last_getheaders.locator.vHave[0]
|
return block_hash == last_getheaders.locator.vHave[0]
|
||||||
|
|
|
@ -236,6 +236,7 @@ fn lint_py_lint() -> LintResult {
|
||||||
"F822", // undefined name name in __all__
|
"F822", // undefined name name in __all__
|
||||||
"F823", // local variable name … referenced before assignment
|
"F823", // local variable name … referenced before assignment
|
||||||
"F841", // local variable 'foo' is assigned to but never used
|
"F841", // local variable 'foo' is assigned to but never used
|
||||||
|
"PLE", // Pylint errors
|
||||||
"W191", // indentation contains tabs
|
"W191", // indentation contains tabs
|
||||||
"W291", // trailing whitespace
|
"W291", // trailing whitespace
|
||||||
"W292", // no newline at end of file
|
"W292", // no newline at end of file
|
||||||
|
|
Loading…
Reference in a new issue