Browse Source

tests/extmod: Skip select/socket tests if they can't create UDP socket.

Some targets (eg PYBV10) have the socket module but are unable to create
UDP sockets without a registered NIC.  So skip UDP tests on these targets.

Signed-off-by: Damien George <damien@micropython.org>
pull/12138/head
Damien George 1 year ago
parent
commit
218242d1de
  1. 8
      tests/extmod/select_poll_udp.py
  2. 8
      tests/extmod/socket_udp_nonblock.py

8
tests/extmod/select_poll_udp.py

@ -8,9 +8,13 @@ except (ImportError, AttributeError):
print("SKIP")
raise SystemExit
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(socket.getaddrinfo("127.0.0.1", 8000)[0][-1])
except OSError:
print("SKIP")
raise SystemExit
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(socket.getaddrinfo("127.0.0.1", 8000)[0][-1])
poll = select.poll()
# UDP socket should not be readable

8
tests/extmod/socket_udp_nonblock.py

@ -6,9 +6,13 @@ except ImportError:
print("SKIP")
raise SystemExit
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(socket.getaddrinfo("127.0.0.1", 8000)[0][-1])
except OSError:
print("SKIP")
raise SystemExit
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(socket.getaddrinfo("127.0.0.1", 8000)[0][-1])
s.settimeout(0)
try:

Loading…
Cancel
Save