Skip to content
Snippets Groups Projects
Commit bc7659eb authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

tests/connect_nonblock: Refactor towards real net_hosted test.

In the future, a special runner for such tests will import each test and
call test() function with an address of test server to use.
parent 3f9d59c8
No related branches found
No related tags found
No related merge requests found
...@@ -5,10 +5,16 @@ try: ...@@ -5,10 +5,16 @@ try:
except: except:
import socket import socket
def test(peer_addr):
s = socket.socket() s = socket.socket()
s.setblocking(False) s.setblocking(False)
try: try:
s.connect(socket.getaddrinfo('micropython.org', 80)[0][-1]) s.connect(peer_addr)
except OSError as er: except OSError as er:
print(er.args[0] == 115) # 115 is EINPROGRESS print(er.args[0] == 115) # 115 is EINPROGRESS
s.close() s.close()
if __name__ == "__main__":
test(socket.getaddrinfo('micropython.org', 80)[0][-1])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment