diff options
author | Georg Brandl <georg@python.org> | 2010-11-20 14:16:17 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2010-11-20 14:16:17 (GMT) |
commit | 89197fe93c4a3f3e983721b0325b7bb5613c7e9c (patch) | |
tree | 3c6da229de6dafad834b489221270e7370c2519b /Lib/test/test_socket.py | |
parent | cd6bb26fa766723bdd7a771932d4863ed304966c (diff) | |
download | cpython-89197fe93c4a3f3e983721b0325b7bb5613c7e9c.zip cpython-89197fe93c4a3f3e983721b0325b7bb5613c7e9c.tar.gz cpython-89197fe93c4a3f3e983721b0325b7bb5613c7e9c.tar.bz2 |
socket.gethostbyname(socket.gethostname()) can fail when host name resolution is not set up correctly; do not fail test_socket if this is the case.
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r-- | Lib/test/test_socket.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 57395b0..9f27a51 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -544,7 +544,11 @@ class GeneralModuleTests(unittest.TestCase): # XXX(nnorwitz): http://tinyurl.com/os5jz seems to indicate # it reasonable to get the host's addr in addition to 0.0.0.0. # At least for eCos. This is required for the S/390 to pass. - my_ip_addr = socket.gethostbyname(socket.gethostname()) + try: + my_ip_addr = socket.gethostbyname(socket.gethostname()) + except socket.error: + # Probably name lookup wasn't set up right; skip this test + return self.assertIn(name[0], ("0.0.0.0", my_ip_addr), '%s invalid' % name[0]) self.assertEqual(name[1], port) |