From: Bob Halley Date: Tue, 7 Jul 2020 03:14:21 +0000 (-0700) Subject: Give up on socket.getfqdn() testing with CDN-hosted resources as it has too much... X-Git-Tag: v2.0.0~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=72d3987c86ec143f4c5f38ca4c865c35bbc44b41;p=thirdparty%2Fdnspython.git Give up on socket.getfqdn() testing with CDN-hosted resources as it has too much magic. --- diff --git a/tests/test_resolver_override.py b/tests/test_resolver_override.py index 5f93281e..73484f66 100644 --- a/tests/test_resolver_override.py +++ b/tests/test_resolver_override.py @@ -118,13 +118,22 @@ class OverrideSystemResolverTestCase(unittest.TestCase): except socket.gaierror as e: self.assertEqual(e.errno, socket.EAI_NONAME) - def test_getfqdn(self): - b = socket.getfqdn('www.dnspython.org') - # we do this now because python's original getfqdn calls - # gethostbyaddr() and we don't want it to call us! - dns.resolver.restore_system_resolver() - a = dns.resolver._original_getfqdn('www.dnspython.org') - self.assertEqual(dns.name.from_text(a), dns.name.from_text(b)) +# Give up on testing this for now as all of the names I've considered +# using for testing are part of CDNs and there is deep magic in +# gethostbyaddr() that python's getfqdn() is using. At any rate, +# the problem is that dnspython just gives up whereas the native python +# code is looking up www.dnspython.org, picking a CDN IPv4 address +# (sometimes) and returning the reverse lookup of that address (i.e. +# the domain name of the CDN server). This isn't what I'd consider the +# FQDN of www.dnspython.org to be! +# +# def test_getfqdn(self): +# b = socket.getfqdn('www.dnspython.org') +# # we do this now because python's original getfqdn calls +# # gethostbyaddr() and we don't want it to call us! +# dns.resolver.restore_system_resolver() +# a = dns.resolver._original_getfqdn('www.dnspython.org') +# self.assertEqual(dns.name.from_text(a), dns.name.from_text(b)) def test_gethostbyaddr(self): a = dns.resolver._original_gethostbyaddr('8.8.8.8')