Commit 71e02946 authored by Guido van Rossum's avatar Guido van Rossum

Skip testHostnameRes() if gethostbyname() raises an exception.

parent 490602d6
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment