mirror of https://github.com/python/cpython
Skip testHostnameRes() if gethostbyname() raises an exception.
This commit is contained in:
parent
490602d629
commit
71e02946ff
|
@ -220,7 +220,11 @@ class GeneralModuleTests(unittest.TestCase):
|
|||
def testHostnameRes(self):
|
||||
# Testing hostname resolution mechanisms
|
||||
hostname = socket.gethostname()
|
||||
ip = socket.gethostbyname(hostname)
|
||||
try:
|
||||
ip = socket.gethostbyname(hostname)
|
||||
except socket.error:
|
||||
# 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)
|
||||
all_host_names = [hname] + aliases
|
||||
|
|
Loading…
Reference in New Issue