CPython changed its non-blocking socket behaviour recently and this test
would not run under CPython anymore. So the following steps were taken to
get the test working again and then simplify it:
- Run the test against CPython 3.10.10 and capture the output into the .exp
file for the test.
- Run this test on unix port of MicroPython and verify that the output
matches the CPython 3.10.10 output in the new .exp file (it did). From
now on take unix MicroPython as the source of truth for this test when
modifying it.
- Remove all code that was there for CPython compatibility.
- Make it print out more useful information during the test run, including
names of the OSError errno values.
- Add polling of the socket before the send/write/recv/read to verify that
the poll gives the correct result in non-blocking mode.
Tested on unix MicroPython, ESP32_GENERIC, PYBD_SF2 and RPI_PICO_W boards.
Signed-off-by: Damien George <damien@micropython.org>
Changes are:
- use ssl.SSLContext.wrap_socket instead of ssl.wrap_socket
- disable check_hostname and call load_default_certs() where appropriate,
to get CPython to run the tests correctly
- pass socket.AF_INET to getaddrinfo and socket.socket(), to force IPv4
- change tests to use github.com instead of google.com, because certificate
validation was failing with google.com
Signed-off-by: Damien George <damien@micropython.org>