What changed, and why it matters
This commit only changes test files to clean up network connections more thoroughly after unit tests finish. It does not affect the actual Electrum wallet software that users run, and there is no security issue being fixed here.
No action required; this is a routine test-maintenance commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch modifies asyncTearDown methods in tests/test_interface.py and tests/test_lntransport.py to explicitly close any open interface connection and await server.wait_closed(). This is a test-hygiene improvement to avoid leaked sockets/tasks between test cases. No production code is changed.
Changed components
tests/test_interface.pytests/test_lntransport.pyInspect captured patch +5 / −0
diff --git a/tests/test_interface.py b/tests/test_interface.py
index aa54f9b..da4f607 100644
--- a/tests/test_interface.py
+++ b/tests/test_interface.py
@@ -71,6 +71,7 @@ class MockNetwork:
self.proxy = None
self.debug = True
self.bhi_lock = asyncio.Lock()
+ self.interface = None # type: Interface | None
async def connection_down(self, interface: Interface):
pass
@@ -199,7 +200,10 @@ class TestInterface(ElectrumTestCase):
self.network = MockNetwork(config=self.config)
async def asyncTearDown(self):
+ if self.network.interface:
+ await self.network.interface.close()
self._server.close()
+ await self._server.wait_closed()
await super().asyncTearDown()
async def _start_iface_and_wait_for_sync(self):
diff --git a/tests/test_lntransport.py b/tests/test_lntransport.py
index 07bd1fc..bcad665 100644
--- a/tests/test_lntransport.py
+++ b/tests/test_lntransport.py
@@ -102,6 +102,7 @@ class TestLNTransport(ElectrumTestCase):
for t in transports:
t.close()
server.close()
+ await server.wait_closed()
await f()
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.