HomePhabricator

test: Avoid logging error when logging error

Description

test: Avoid logging error when logging error

Summary:
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,

Backport of core#31408

Reviewer note: This was an AI-automated backport.

Test Plan:
Without patch applied:
Edit test_framework/p2p.py per above instructions.

./test/functional/test_runner.py p2p_addrv2_relay

See that there are two stack traces. One has the intended error message and another the indicates the logging call is broken.

With the patch applied:
Edit test_framework/p2p.py per above instructions.

./test/functional/test_runner.py p2p_addrv2_relay

See that there is only the intended stack trace.

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Subscribers: PiRK

Differential Revision: https://reviews.bitcoinabc.org/D20293

Details

Provenance
merge-script <fanquake@gmail.com>Authored on Dec 5 2024, 17:17
roqqitCommitted on Jul 15 2026, 22:51
roqqitPushed on Jul 15 2026, 22:51
Reviewer
Restricted Project
Differential Revision
D20293: test: Avoid logging error when logging error
Parents
rABC18953a53001e: [ecash-parse] Compact notification amounts; open app on push tap
Branches
Unknown
Tags
Unknown