From 274306860b2d64b67ef6e8a14e8af3fd56c8d0ff Mon Sep 17 00:00:00 2001 From: Yanfeng Liu Date: Fri, 11 Jul 2025 08:24:20 +0800 Subject: [PATCH] tests/extmod: Close UDP sockets at end of test. This adds call to release UDP port in a timely manner, so they can be reused in subsequent tests. Otherwise, one could face issue like #17623. Signed-off-by: Yanfeng Liu --- tests/extmod/select_poll_udp.py | 2 ++ tests/extmod/socket_udp_nonblock.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tests/extmod/select_poll_udp.py b/tests/extmod/select_poll_udp.py index 133871b1a4..887176a4f6 100644 --- a/tests/extmod/select_poll_udp.py +++ b/tests/extmod/select_poll_udp.py @@ -29,3 +29,5 @@ print(poll.poll(0)[0][1] == select.POLLOUT) if hasattr(select, "select"): r, w, e = select.select([s], [], [], 0) assert not r and not w and not e + +s.close() diff --git a/tests/extmod/socket_udp_nonblock.py b/tests/extmod/socket_udp_nonblock.py index 1e74e2917d..394115e4b8 100644 --- a/tests/extmod/socket_udp_nonblock.py +++ b/tests/extmod/socket_udp_nonblock.py @@ -19,3 +19,5 @@ try: s.recv(1) except OSError as er: print("EAGAIN:", er.errno == errno.EAGAIN) + +s.close()