Skip to content

Commit 168e2c8

Browse files
committed
tests/extmod/select_poll_eintr.py: Skip test if target can't bind.
Eg on PYBV10 with THREAD variant, the firmware has both the `_thread` and `socket` modules but no NIC. Signed-off-by: Damien George <damien@micropython.org>
1 parent b680011 commit 168e2c8

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

tests/extmod/select_poll_eintr.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@
1010
print("SKIP")
1111
raise SystemExit
1212

13+
# Use a new UDP socket for tests, which should be writable but not readable.
14+
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
15+
localhost_addr_info = socket.getaddrinfo("127.0.0.1", 8000)
16+
try:
17+
s.bind(localhost_addr_info[0][-1])
18+
except OSError:
19+
# Target can't bind to localhost.
20+
# Most likely it doesn't have a NIC and the test cannot be run.
21+
s.close()
22+
print("SKIP")
23+
raise SystemExit
24+
1325

1426
def thread_main():
1527
lock.acquire()
@@ -26,10 +38,6 @@ def thread_main():
2638
lock.acquire()
2739
_thread.start_new_thread(thread_main, ())
2840

29-
# Use a new UDP socket for tests, which should be writable but not readable.
30-
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
31-
s.bind(socket.getaddrinfo("127.0.0.1", 8000)[0][-1])
32-
3341
# Create the poller object.
3442
poller = select.poll()
3543
poller.register(s, select.POLLIN)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy