From 7bfbdb050f4ef653a7a9b21874dfeb6e3ff1d0a2 Mon Sep 17 00:00:00 2001 From: Bruce Merry Date: Thu, 3 Aug 2023 10:27:50 +0200 Subject: [PATCH] Close custom TCP sockets This avoids ResourceWarnings from pytest when run under python -X dev. --- tests/test_passthrough.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_passthrough.py b/tests/test_passthrough.py index d3b10d5c6..b83e9cfe2 100644 --- a/tests/test_passthrough.py +++ b/tests/test_passthrough.py @@ -711,11 +711,14 @@ def prepare_receiver(self, receiver): self._port = sock.getsockname()[1] sock.listen(1) receiver.add_tcp_reader(sock) + sock.close() def prepare_sender(self, thread_pool): sock = socket.socket() sock.connect(("127.0.0.1", self._port)) - return spead2.send.TcpStream(thread_pool, sock) + sender = spead2.send.TcpStream(thread_pool, sock) + sock.close() + return sender class TestPassthroughTcp6(BaseTestPassthrough):