Skip to content

Commit

Permalink
tests/extmod: Skip select/socket tests if they can't create UDP socket.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
dpgeorge committed Aug 7, 2023
1 parent 6b78a1b commit 218242d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions tests/extmod/select_poll_udp.py
Expand Up @@ -8,9 +8,13 @@
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
Expand Down
8 changes: 6 additions & 2 deletions tests/extmod/socket_udp_nonblock.py
Expand Up @@ -6,9 +6,13 @@
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:
Expand Down

0 comments on commit 218242d

Please sign in to comment.