From: Guido van Rossum Date: Thu, 26 Dec 2002 17:04:45 +0000 (+0000) Subject: Also skip testHostnameRes() if gethostbyaddr() raises an exception. X-Git-Tag: v2.3c1~2874 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9647b5240cb407a04d09dba0aa54058f3a07f460;p=python Also skip testHostnameRes() if gethostbyaddr() raises an exception. --- diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 11883a8857..bca1c6cabd 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -226,7 +226,11 @@ class GeneralModuleTests(unittest.TestCase): # Probably name lookup wasn't set up right; skip this test return self.assert_(ip.find('.') >= 0, "Error resolving host to ip.") - hname, aliases, ipaddrs = socket.gethostbyaddr(ip) + try: + hname, aliases, ipaddrs = socket.gethostbyaddr(ip) + except socket.error: + # Probably a similar problem as above; skip this test + return all_host_names = [hname] + aliases fqhn = socket.getfqdn() if not fqhn in all_host_names: