mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
asyncio: Use socket specs for getaddrinfo() in sock_connect()
Patch by Martin Richard. GH PR #365.
This commit is contained in:
parent
77bc04a3bc
commit
63bf487688
2 changed files with 13 additions and 1 deletions
|
@ -373,6 +373,17 @@ class BaseSelectorEventLoopTests(test_utils.TestCase):
|
|||
self.loop.run_until_complete(fut)
|
||||
self.assertTrue(self.loop.remove_writer.called)
|
||||
|
||||
def test_sock_connect_resolve_using_socket_params(self):
|
||||
addr = ('need-resolution.com', 8080)
|
||||
sock = test_utils.mock_nonblocking_socket()
|
||||
self.loop.getaddrinfo = mock.Mock()
|
||||
self.loop.sock_connect(sock, addr)
|
||||
while not self.loop.getaddrinfo.called:
|
||||
self.loop._run_once()
|
||||
self.loop.getaddrinfo.assert_called_with(
|
||||
*addr, type=sock.type, family=sock.family, proto=sock.proto,
|
||||
flags=0)
|
||||
|
||||
def test__sock_connect(self):
|
||||
f = asyncio.Future(loop=self.loop)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue