From: Bob Halley Date: Sat, 11 Jun 2022 02:49:53 +0000 (-0700) Subject: apply v4/v6 testing scheme from query tests to async too X-Git-Tag: v2.3.0rc1~68^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F815%2Fhead;p=thirdparty%2Fdnspython.git apply v4/v6 testing scheme from query tests to async too --- 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",