micropython/tests/net_hosted
Damien George 7ec95c2768 extmod/uasyncio: Get addr and bind server socket before creating task.
Currently when using uasyncio.start_server() the socket configuration is
done inside a uasyncio.create_task() background function.  If the address
and port are already in use however this throws an OSError which cannot be
cleanly caught behind the create_task().

This commit moves the getaddrinfo and socket binding to the start_server()
function, and only creates the task if that succeeds.  This means that any
OSError from the initial socket configuration is propagated directly up the
call stack, compatible with CPython behaviour.

See #7444.

Signed-off-by: Damien George <damien@micropython.org>
2021-06-26 22:30:22 +10:00
..
README tests: Rename run-tests to run-tests.py for consistency. 2021-03-12 19:56:09 +11:00
accept_nonblock.py tests: Use .errno instead of .args[0] for OSError exceptions. 2021-04-23 22:03:46 +10:00
accept_nonblock.py.exp tests/net_inet: Move tests which don't require full Internet to net_hosted. 2017-06-23 21:12:32 +03:00
accept_timeout.py tests: Use .errno instead of .args[0] for OSError exceptions. 2021-04-23 22:03:46 +10:00
accept_timeout.py.exp tests/net_inet: Move tests which don't require full Internet to net_hosted. 2017-06-23 21:12:32 +03:00
connect_nonblock.py tests: Use .errno instead of .args[0] for OSError exceptions. 2021-04-23 22:03:46 +10:00
connect_nonblock.py.exp tests/net_inet: Move tests which don't require full Internet to net_hosted. 2017-06-23 21:12:32 +03:00
connect_nonblock_xfer.py tests: Use .errno instead of .args[0] for OSError exceptions. 2021-04-23 22:03:46 +10:00
connect_poll.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
connect_poll.py.exp extmod/modlwip: Unconditionally return POLLHUP when polling new socket. 2019-10-31 12:54:37 +11:00
ssl_getpeercert.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
ssl_getpeercert.py.exp extmod/modussl_mbedtls.c: Add ussl.getpeercert() method. 2017-08-16 15:01:00 +10:00
uasyncio_start_server.py extmod/uasyncio: Get addr and bind server socket before creating task. 2021-06-26 22:30:22 +10:00
uasyncio_start_server.py.exp extmod/uasyncio: Get addr and bind server socket before creating task. 2021-06-26 22:30:22 +10:00

README

This directory contains network tests which require just "peer to peer"
network connection between test host and device under test, instead of
full Internet connection.

Note that setup for these tests and tests themselves are WIP, and may
not yet fully correspond to the functional specification above.

So far, these tests are not run as part of the main testsuite and need
to be run seperately (from the main test/ directory):

    ./run-tests.py net_hosted/*.py