mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
Also skip testHostnameRes() if gethostbyaddr() raises an exception.
This commit is contained in:
parent
71e02946ff
commit
9647b5240c
1 changed files with 5 additions and 1 deletions
|
@ -226,7 +226,11 @@ class GeneralModuleTests(unittest.TestCase):
|
||||||
# Probably name lookup wasn't set up right; skip this test
|
# Probably name lookup wasn't set up right; skip this test
|
||||||
return
|
return
|
||||||
self.assert_(ip.find('.') >= 0, "Error resolving host to ip.")
|
self.assert_(ip.find('.') >= 0, "Error resolving host to ip.")
|
||||||
|
try:
|
||||||
hname, aliases, ipaddrs = socket.gethostbyaddr(ip)
|
hname, aliases, ipaddrs = socket.gethostbyaddr(ip)
|
||||||
|
except socket.error:
|
||||||
|
# Probably a similar problem as above; skip this test
|
||||||
|
return
|
||||||
all_host_names = [hname] + aliases
|
all_host_names = [hname] + aliases
|
||||||
fqhn = socket.getfqdn()
|
fqhn = socket.getfqdn()
|
||||||
if not fqhn in all_host_names:
|
if not fqhn in all_host_names:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue