From 5760fb3ad945771da110fd13144fe972fd6d0b00 Mon Sep 17 00:00:00 2001 From: Ian McEwen Date: Tue, 7 Jul 2026 12:40:25 -0700 Subject: [PATCH] Add reconnect for firmware_node --- meshtastic/tests/conftest.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/meshtastic/tests/conftest.py b/meshtastic/tests/conftest.py index 596f4b1..c863888 100644 --- a/meshtastic/tests/conftest.py +++ b/meshtastic/tests/conftest.py @@ -49,8 +49,17 @@ def firmware_node(): _skip_firmware_if_unavailable() mesh = SimMesh(n_nodes=1, base_port=SINGLE_NODE_BASE_PORT) mesh.start() - set_region(mesh.get_node(0).port, "US") - yield mesh.get_node(0) + node = mesh.get_node(0) + set_region(node.port, "US") + # The region commit restarts the TCP listener, so reconnect the harness + # interface in case a test wants to use it directly. + if node.iface is not None: + try: + node.iface.close() + except Exception: # pylint: disable=broad-except + pass + node.connect() + yield node mesh.stop()