1# test that socket.accept() on a socket with timeout raises ETIMEDOUT 2 3try: 4 import usocket as socket 5except: 6 import socket 7 8try: 9 socket.socket.settimeout 10except AttributeError: 11 print("SKIP") 12 raise SystemExit 13 14s = socket.socket() 15s.bind(socket.getaddrinfo("127.0.0.1", 8123)[0][-1]) 16s.settimeout(1) 17s.listen(1) 18try: 19 s.accept() 20except OSError as er: 21 print(er.args[0] in (110, "timed out")) # 110 is ETIMEDOUT; CPython uses a string 22s.close() 23