asyncio: sync with github asyncio

* queues: get coroutine from asyncio.coroutines, not from asyncio.tasks
* tets: replace tulip with asyncio in comments
This commit is contained in:
Victor Stinner 2015-07-09 23:13:50 +02:00
parent af320b389b
commit e6ecea53c8
5 changed files with 10 additions and 8 deletions

View File

@ -9,7 +9,7 @@
from . import events from . import events
from . import futures from . import futures
from . import locks from . import locks
from .tasks import coroutine from .coroutines import coroutine
class QueueEmpty(Exception): class QueueEmpty(Exception):

View File

@ -348,7 +348,7 @@ def test_sock_connect(self):
self.loop._sock_connect.call_args[0]) self.loop._sock_connect.call_args[0])
def test_sock_connect_timeout(self): def test_sock_connect_timeout(self):
# Tulip issue #205: sock_connect() must unregister the socket on # asyncio issue #205: sock_connect() must unregister the socket on
# timeout error # timeout error
# prepare mocks # prepare mocks

View File

@ -580,7 +580,7 @@ def client(path):
@unittest.skipIf(sys.platform == 'win32', "Don't have pipes") @unittest.skipIf(sys.platform == 'win32', "Don't have pipes")
def test_read_all_from_pipe_reader(self): def test_read_all_from_pipe_reader(self):
# See Tulip issue 168. This test is derived from the example # See asyncio issue 168. This test is derived from the example
# subprocess_attach_read_pipe.py, but we configure the # subprocess_attach_read_pipe.py, but we configure the
# StreamReader's limit so that twice it is less than the size # StreamReader's limit so that twice it is less than the size
# of the data writter. Also we must explicitly attach a child # of the data writter. Also we must explicitly attach a child
@ -621,7 +621,7 @@ def test_streamreader_constructor(self):
self.addCleanup(asyncio.set_event_loop, None) self.addCleanup(asyncio.set_event_loop, None)
asyncio.set_event_loop(self.loop) asyncio.set_event_loop(self.loop)
# Tulip issue #184: Ensure that StreamReaderProtocol constructor # asyncio issue #184: Ensure that StreamReaderProtocol constructor
# retrieves the current loop if the loop parameter is not set # retrieves the current loop if the loop parameter is not set
reader = asyncio.StreamReader() reader = asyncio.StreamReader()
self.assertIs(reader._loop, self.loop) self.assertIs(reader._loop, self.loop)
@ -630,7 +630,7 @@ def test_streamreaderprotocol_constructor(self):
self.addCleanup(asyncio.set_event_loop, None) self.addCleanup(asyncio.set_event_loop, None)
asyncio.set_event_loop(self.loop) asyncio.set_event_loop(self.loop)
# Tulip issue #184: Ensure that StreamReaderProtocol constructor # asyncio issue #184: Ensure that StreamReaderProtocol constructor
# retrieves the current loop if the loop parameter is not set # retrieves the current loop if the loop parameter is not set
reader = mock.Mock() reader = mock.Mock()
protocol = asyncio.StreamReaderProtocol(reader) protocol = asyncio.StreamReaderProtocol(reader)

View File

@ -266,7 +266,7 @@ def connect_read_pipe_mock(*args, **kw):
self.assertTrue(transport.resume_reading.called) self.assertTrue(transport.resume_reading.called)
def test_stdin_not_inheritable(self): def test_stdin_not_inheritable(self):
# Tulip issue #209: stdin must not be inheritable, otherwise # asyncio issue #209: stdin must not be inheritable, otherwise
# the Process.communicate() hangs # the Process.communicate() hangs
@asyncio.coroutine @asyncio.coroutine
def len_message(message): def len_message(message):

View File

@ -132,7 +132,8 @@ def test_wait_for_handle(self):
self.assertTrue(fut.result()) self.assertTrue(fut.result())
self.assertTrue(0 <= elapsed < 0.3, elapsed) self.assertTrue(0 <= elapsed < 0.3, elapsed)
# Tulip issue #195: cancelling a done _WaitHandleFuture must not crash # asyncio issue #195: cancelling a done _WaitHandleFuture
# must not crash
fut.cancel() fut.cancel()
def test_wait_for_handle_cancel(self): def test_wait_for_handle_cancel(self):
@ -149,7 +150,8 @@ def test_wait_for_handle_cancel(self):
elapsed = self.loop.time() - start elapsed = self.loop.time() - start
self.assertTrue(0 <= elapsed < 0.1, elapsed) self.assertTrue(0 <= elapsed < 0.1, elapsed)
# Tulip issue #195: cancelling a _WaitHandleFuture twice must not crash # asyncio issue #195: cancelling a _WaitHandleFuture twice
# must not crash
fut = self.loop._proactor.wait_for_handle(event) fut = self.loop._proactor.wait_for_handle(event)
fut.cancel() fut.cancel()
fut.cancel() fut.cancel()