Specify a non-zero port when testing localhost resolution.

Some getaddrinfo implementations (including OS X 10.6) fail
if we try to resolve port 0 without AI_PASSIVE.

Closes #1136.
This commit is contained in:
Ben Darnell 2014-08-12 08:51:27 -04:00
parent 93ae079795
commit afea02e18d
1 changed files with 3 additions and 1 deletions

View File

@ -72,7 +72,9 @@ class TCPClientTest(AsyncTestCase):
super(TCPClientTest, self).tearDown()
def skipIfLocalhostV4(self):
Resolver().resolve('localhost', 0, callback=self.stop)
# The port used here doesn't matter, but some systems require it
# to be non-zero if we do not also pass AI_PASSIVE.
Resolver().resolve('localhost', 80, callback=self.stop)
addrinfo = self.wait()
families = set(addr[0] for addr in addrinfo)
if socket.AF_INET6 not in families: