summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_socket.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-12-26 16:55:15 (GMT)
committerGuido van Rossum <guido@python.org>2002-12-26 16:55:15 (GMT)
commit71e02946ff022adfa391af864638675788e1f044 (patch)
tree1742223dc96eafb5fa1bb6b77f4116c62996360f /Lib/test/test_socket.py
parent490602d6294052bf3308d9970f74e529d7e6da2b (diff)
downloadcpython-71e02946ff022adfa391af864638675788e1f044.zip
cpython-71e02946ff022adfa391af864638675788e1f044.tar.gz
cpython-71e02946ff022adfa391af864638675788e1f044.tar.bz2
Skip testHostnameRes() if gethostbyname() raises an exception.
Diffstat (limited to 'Lib/test/test_socket.py')
-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 ca3c4ff..11883a8 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