Merged already. Upstream pull-request: https://github.com/python-trio/trio/pull/1502.patch From 03f2601503d5d49987c280e0749accbd50a2bb9b Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Thu, 7 May 2020 22:20:49 -0700 Subject: [PATCH 1/4] Add CI for Alpine Also deletes some old dead code in ci.sh --- .github/workflows/ci.yml | 24 ++++++++++++++++++++--- ci.sh | 41 +++++----------------------------------- 2 files changed, 26 insertions(+), 39 deletions(-) diff --git a/trio/tests/test_socket.py b/trio/tests/test_socket.py index c03c8bb8f..47ba558d6 100644 --- a/trio/tests/test_socket.py +++ b/trio/tests/test_socket.py @@ -101,11 +101,19 @@ def test_socket_has_some_reexports(): async def test_getaddrinfo(monkeygai): def check(got, expected): # win32 returns 0 for the proto field - def without_proto(gai_tup): - return gai_tup[:2] + (0,) + gai_tup[3:] - - expected2 = [without_proto(gt) for gt in expected] - assert got == expected or got == expected2 + # alpine and glibc have inconsistent handling of the canonical name + # field (https://github.com/python-trio/trio/issues/1499) + # Neither gets used much and there isn't much opportunity for us to + # mess them up, so we don't bother checking them + def interesting_fields(gai_tup): + # (family, type, proto, canonname, sockaddr) + family, type, proto, canonname, sockaddr = gai_tup + return (family, type, sockaddr) + + def filtered(gai_list): + return [interesting_fields(gai_tup) for gai_tup in gai_list] + + assert filtered(got) == filtered(expected) # Simple non-blocking non-error cases, ipv4 and ipv6: with assert_checkpoints(): From 68261db43fe79c3a8b5a22659de159fe40329daf Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Thu, 7 May 2020 23:31:24 -0700 Subject: [PATCH 3/4] Another small test tweak to work around an Alpine quirk --- trio/tests/test_socket.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/trio/tests/test_socket.py b/trio/tests/test_socket.py index 47ba558d6..8be7b7ea4 100644 --- a/trio/tests/test_socket.py +++ b/trio/tests/test_socket.py @@ -151,8 +151,10 @@ def filtered(gai_list): with assert_checkpoints(): with pytest.raises(tsocket.gaierror) as excinfo: await tsocket.getaddrinfo("::1", "12345", type=-1) - # Linux, Windows + # Linux + glibc, Windows expected_errnos = {tsocket.EAI_SOCKTYPE} + # Linux + musl + expected_errnos.add(tsocket.EAI_SERVICE) # macOS if hasattr(tsocket, "EAI_BADHINTS"): expected_errnos.add(tsocket.EAI_BADHINTS) From cdbbd2d84823006309b2aed9b8a86cd86b03670a Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Thu, 7 May 2020 23:38:15 -0700 Subject: [PATCH 4/4] Slightly more accurate comment --- trio/tests/test_socket.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/trio/tests/test_socket.py b/trio/tests/test_socket.py index 8be7b7ea4..4e76711d3 100644 --- a/trio/tests/test_socket.py +++ b/trio/tests/test_socket.py @@ -101,10 +101,10 @@ def test_socket_has_some_reexports(): async def test_getaddrinfo(monkeygai): def check(got, expected): # win32 returns 0 for the proto field - # alpine and glibc have inconsistent handling of the canonical name + # musl and glibc have inconsistent handling of the canonical name # field (https://github.com/python-trio/trio/issues/1499) - # Neither gets used much and there isn't much opportunity for us to - # mess them up, so we don't bother checking them + # Neither field gets used much and there isn't much opportunity for us + # to mess them up, so we don't bother checking them here def interesting_fields(gai_tup): # (family, type, proto, canonname, sockaddr) family, type, proto, canonname, sockaddr = gai_tup