From ec0f9260b5940b3af52bf36008755b4d2b679537 Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Fri, 10 Jun 2022 19:49:53 -0700 Subject: [PATCH] apply v4/v6 testing scheme from query tests to async too --- tests/test_async.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/tests/test_async.py b/tests/test_async.py index 21758d9e..f40146e2 100644 --- a/tests/test_async.py +++ b/tests/test_async.py @@ -53,20 +53,11 @@ try: except Exception: pass -# Probe for IPv4 and IPv6 query_addresses = [] -for (af, address) in ( - (socket.AF_INET, "8.8.8.8"), - (socket.AF_INET6, "2001:4860:4860::8888"), -): - try: - with socket.socket(af, socket.SOCK_DGRAM) as s: - # Connecting a UDP socket is supposed to return ENETUNREACH if - # no route to the network is present. - s.connect((address, 53)) - query_addresses.append(address) - except Exception: - pass +if tests.util.have_ipv4(): + query_addresses.append("8.8.8.8") +if tests.util.have_ipv6(): + query_addresses.append("2001:4860:4860::8888") KNOWN_ANYCAST_DOH_RESOLVER_URLS = [ "https://cloudflare-dns.com/dns-query", -- 2.47.3