tests: Make proxy_test work on travis servers without IPv6
Github-Pull: #7489 Rebased-From:7539f1aae3Cherry-picked-From:9ca957bcd4
This commit is contained in:
committed by
Braydon Fuller
parent
5fa85bc9ae
commit
9c5b709c6f
@@ -137,3 +137,18 @@ def addr_to_hex(addr):
|
||||
else:
|
||||
raise ValueError('Could not parse address %s' % addr)
|
||||
return binascii.hexlify(bytearray(addr))
|
||||
|
||||
def test_ipv6_local():
|
||||
'''
|
||||
Check for (local) IPv6 support.
|
||||
'''
|
||||
import socket
|
||||
# By using SOCK_DGRAM this will not actually make a connection, but it will
|
||||
# fail if there is no route to IPv6 localhost.
|
||||
have_ipv6 = True
|
||||
try:
|
||||
s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
|
||||
s.connect(('::1', 0))
|
||||
except socket.error:
|
||||
have_ipv6 = False
|
||||
return have_ipv6
|
||||
|
||||
Reference in New Issue
Block a user