Commit Graph

7 Commits

Author SHA1 Message Date
Thorsten von Eicken
ab4e197707 esp32/modsocket: Fix getaddrinfo to raise on error.
This commit fixes the behaviour of socket.getaddrinfo on the ESP32 so it
raises an OSError when the name resolution fails instead of returning a []
or a resolution for 0.0.0.0.

Tests are added (generic and ESP32-specific) to verify behaviour consistent
with CPython, modulo the different types of exceptions per MicroPython
documentation.
2020-05-09 16:43:48 +10:00
David Lechner
3dc324d3f1 tests: Format all Python code with black, except tests in basics subdir.
This adds the Python files in the tests/ directory to be formatted with
./tools/codeformat.py.  The basics/ subdirectory is excluded for now so we
aren't changing too much at once.

In a few places `# fmt: off`/`# fmt: on` was used where the code had
special formatting for readability or where the test was actually testing
the specific formatting.
2020-03-30 13:21:58 +11:00
Damien George
081d067662 tests/net_inet: Add uasyncio internet tests. 2020-03-26 01:25:45 +11:00
Damien George
f36975b679 tests/net_inet: Update tls test to work with CPython and incl new site.
CPython only supports the server_hostname keyword arg via the SSLContext
object, so use that instead of the top-level ssl.wrap_socket.  This allows
the test to run on CPython the same as uPy.

Also add the "Host:" header to correctly make a GET request (for URLs that
are hosted on other servers).  This is not strictly needed to test the SSL
connection but helps to debug things when printing the response.
2017-10-26 12:29:24 +11:00
Paul Sokolovsky
3f9d59c87a tests/net_inet: Move tests which don't require full Internet to net_hosted.
The idea is that these tests can be run with just a test server running
on a test host, with device under test connecting to it, instead of
requiring Internet connection for testing.

Such setup is however WIP, and some tests in net_hosted/ are so far
written to connect to Internet, as there're not test server written
yet. This is expected to evolve over time.
2017-06-23 21:12:32 +03:00
Damien George
458cbacb8f tests/net_inet: Add tests for accept and connect in nonblocking mode.
Some of these tests don't require an Internet connection, but here is a
good place to put them for now.
2017-06-21 12:25:10 +10:00
Paul Sokolovsky
4caa27ae0e tests/net_inet/test_tls_sites.py: Integration test for SSL connections.
This attempts to bootstrap network tests for MicroPython. This commits
sets test/net_inet/ as place for tests which require access to wide
Internet. They aren't intended to be run as part of the main testsuite,
instead to be run manually on demand.

test_tls_sites.py in particular check that it's possible to establish
SSL/TLS connection to select sites on the Internet: few references ones,
plus those for which problems were reported, and resolved.
2017-06-21 01:58:36 +03:00