summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/test_proactor_events.py
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2015-12-17 00:31:17 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2015-12-17 00:31:17 (GMT)
commitd5c2a6210026834eb3cb7165e470d2cbc3065db8 (patch)
tree27996fb066b690bde43694bdfd6b50deaed8f630 /Lib/test/test_asyncio/test_proactor_events.py
parent8c084eb77d69ec1527fad943a4031b1b29193e98 (diff)
downloadcpython-d5c2a6210026834eb3cb7165e470d2cbc3065db8.zip
cpython-d5c2a6210026834eb3cb7165e470d2cbc3065db8.tar.gz
cpython-d5c2a6210026834eb3cb7165e470d2cbc3065db8.tar.bz2
asyncio: Skip getaddrinfo if host is already resolved.
getaddrinfo takes an exclusive lock on some platforms, causing clients to queue up waiting for the lock if many names are being resolved concurrently. Users may want to handle name resolution in their own code, for the sake of caching, using an alternate resolver, or to measure DNS duration separately from connection duration. Skip getaddrinfo if the "host" passed into create_connection is already resolved. See https://github.com/python/asyncio/pull/302 for details. Patch by A. Jesse Jiryu Davis.
Diffstat (limited to 'Lib/test/test_asyncio/test_proactor_events.py')
-rw-r--r--Lib/test/test_asyncio/test_proactor_events.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/test/test_asyncio/test_proactor_events.py b/Lib/test/test_asyncio/test_proactor_events.py
index 5a0f088..5a92b1e 100644
--- a/Lib/test/test_asyncio/test_proactor_events.py
+++ b/Lib/test/test_asyncio/test_proactor_events.py
@@ -436,7 +436,7 @@ class ProactorSocketTransportTests(test_utils.TestCase):
class BaseProactorEventLoopTests(test_utils.TestCase):
def setUp(self):
- self.sock = mock.Mock(socket.socket)
+ self.sock = test_utils.mock_nonblocking_socket()
self.proactor = mock.Mock()
self.ssock, self.csock = mock.Mock(), mock.Mock()
@@ -491,8 +491,8 @@ class BaseProactorEventLoopTests(test_utils.TestCase):
self.proactor.send.assert_called_with(self.sock, b'data')
def test_sock_connect(self):
- self.loop.sock_connect(self.sock, 123)
- self.proactor.connect.assert_called_with(self.sock, 123)
+ self.loop.sock_connect(self.sock, ('1.2.3.4', 123))
+ self.proactor.connect.assert_called_with(self.sock, ('1.2.3.4', 123))
def test_sock_accept(self):
self.loop.sock_accept(self.sock)