From b879e0cc5c7b8380de17f28ae11a4d4332454425 Mon Sep 17 00:00:00 2001 From: sparklelcm333 Date: Sun, 21 Jun 2026 11:58:19 +0800 Subject: [PATCH] fix: use dynamic port for UDP broadcast test to avoid CI port conflicts --- test/test_udp.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/test_udp.py b/test/test_udp.py index c8a2cc7..69559df 100644 --- a/test/test_udp.py +++ b/test/test_udp.py @@ -5,8 +5,6 @@ from src.connect_udp import UDP -UDP_BROADCAST_PORT = 65030 - def test_udp_server_init(udp_server): assert udp_server.port > 0 @@ -50,12 +48,12 @@ def on_msg(data, addr): def test_udp_broadcast(): received = threading.Event() - s1 = UDP("0.0.0.0", UDP_BROADCAST_PORT) + s1 = UDP("0.0.0.0", 0) s1.listen(lambda data, addr: received.set()) c = UDP("0.0.0.0") try: - c.broadcast(b"/probe", UDP_BROADCAST_PORT) + c.broadcast(b"/probe", s1.port) assert received.wait(timeout=2), "did not receive broadcast" finally: c.close()