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>
This commit is contained in:
Damien George 2023-08-07 12:36:00 +10:00
parent 6b78a1bf00
commit 218242d1de
2 changed files with 12 additions and 4 deletions

View File

@ -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

View File

@ -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: