summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Lib/test/test_socket.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index ca3c4ff218..11883a8857 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -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