diff options
| author | Damien George <damien@micropython.org> | 2025-06-30 11:53:00 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2025-07-08 13:19:00 +1000 |
| commit | 168e2c8f66d9cfb8c5212fc236aa645ad8275876 (patch) | |
| tree | 18cd1e4fb7d3408f3a4da28495e049b26e11c4bb | |
| parent | b680011d91229e6eff76e6e02bf3f3b3f537967b (diff) | |
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>
| -rw-r--r-- | tests/extmod/select_poll_eintr.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/extmod/select_poll_eintr.py b/tests/extmod/select_poll_eintr.py index e1cbc2aaf..d9e9b3190 100644 --- a/tests/extmod/select_poll_eintr.py +++ b/tests/extmod/select_poll_eintr.py @@ -10,6 +10,18 @@ except (ImportError, AttributeError): print("SKIP") raise SystemExit +# Use a new UDP socket for tests, which should be writable but not readable. +s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) +localhost_addr_info = socket.getaddrinfo("127.0.0.1", 8000) +try: + s.bind(localhost_addr_info[0][-1]) +except OSError: + # Target can't bind to localhost. + # Most likely it doesn't have a NIC and the test cannot be run. + s.close() + print("SKIP") + raise SystemExit + def thread_main(): lock.acquire() @@ -26,10 +38,6 @@ lock = _thread.allocate_lock() lock.acquire() _thread.start_new_thread(thread_main, ()) -# Use a new UDP socket for tests, which should be writable but not readable. -s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) -s.bind(socket.getaddrinfo("127.0.0.1", 8000)[0][-1]) - # Create the poller object. poller = select.poll() poller.register(s, select.POLLIN) |
