|
@@ -555,16 +555,21 @@ class TestUnixSockServer(unittest.TestCase):
|
|
|
sock.connect(('127.0.0.1', 12345))
|
|
|
self.assertEqual(('127.0.0.1', 12345),
|
|
|
self.unix._guess_remote(sock.fileno()))
|
|
|
- sock = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
|
|
|
- sock.connect(('::1', 12345))
|
|
|
- self.assertEqual(('::1', 12345, 0, 0),
|
|
|
- self.unix._guess_remote(sock.fileno()))
|
|
|
- # Try when pretending there's no IPv6 support
|
|
|
- xfrout.socket.has_ipv6 = False
|
|
|
- sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
|
- sock.connect(('127.0.0.1', 12345))
|
|
|
- self.assertEqual(('127.0.0.1', 12345),
|
|
|
- self.unix._guess_remote(sock.fileno()))
|
|
|
+ if socket.has_ipv6:
|
|
|
+ # Don't check IPv6 address on hosts not supporting them
|
|
|
+ sock = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
|
|
|
+ sock.connect(('::1', 12345))
|
|
|
+ self.assertEqual(('::1', 12345, 0, 0),
|
|
|
+ self.unix._guess_remote(sock.fileno()))
|
|
|
+ # Try when pretending there's no IPv6 support
|
|
|
+ # (No need to pretend when there's really no IPv6)
|
|
|
+ xfrout.socket.has_ipv6 = False
|
|
|
+ sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
|
+ sock.connect(('127.0.0.1', 12345))
|
|
|
+ self.assertEqual(('127.0.0.1', 12345),
|
|
|
+ self.unix._guess_remote(sock.fileno()))
|
|
|
+ # Return it back
|
|
|
+ xfrout.socket.has_ipv6 = True
|
|
|
|
|
|
def test_receive_query_message(self):
|
|
|
send_msg = b"\xd6=\x00\x00\x00\x01\x00"
|