diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-07-11 09:58:33 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-07-11 09:58:33 (GMT) |
commit | 770e48d0174726e339074cfffa68fce23768aab5 (patch) | |
tree | 807e997af92d392c29b5e060588460d42d3aec00 /Lib/test | |
parent | 3740d589f7e1737da480b2730161cb835b8dd55c (diff) | |
download | cpython-770e48d0174726e339074cfffa68fce23768aab5.zip cpython-770e48d0174726e339074cfffa68fce23768aab5.tar.gz cpython-770e48d0174726e339074cfffa68fce23768aab5.tar.bz2 |
asyncio: sync with Tulip
* Tulip issue #182: Improve logs of BaseEventLoop._run_once()
- Don't log non-blocking poll
- Only log polling with a timeout if it gets events or if it timed out after
more than 1 second.
* Fix some pyflakes warnings: remove unused imports
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_asyncio/test_base_events.py | 2 | ||||
-rw-r--r-- | Lib/test/test_asyncio/test_events.py | 2 | ||||
-rw-r--r-- | Lib/test/test_asyncio/test_tasks.py | 9 |
3 files changed, 6 insertions, 7 deletions
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py index f6da7c3..27610f0 100644 --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -12,7 +12,6 @@ from test.support import IPV6_ENABLED import asyncio from asyncio import base_events -from asyncio import events from asyncio import constants from asyncio import test_utils @@ -26,6 +25,7 @@ class BaseEventLoopTests(test_utils.TestCase): def setUp(self): self.loop = base_events.BaseEventLoop() self.loop._selector = mock.Mock() + self.loop._selector.select.return_value = () self.set_event_loop(self.loop) def test_not_implemented(self): diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py index e04c287..06552f8 100644 --- a/Lib/test/test_asyncio/test_events.py +++ b/Lib/test/test_asyncio/test_events.py @@ -715,7 +715,7 @@ class EventLoopTestsMixin: with self.assertRaisesRegex(ValueError, 'path and sock can not be specified ' 'at the same time'): - server = self.loop.run_until_complete(f) + self.loop.run_until_complete(f) def _create_ssl_context(self, certfile, keyfile=None): sslcontext = ssl.SSLContext(ssl.PROTOCOL_SSLv23) diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py index 85648dc..ca770f9 100644 --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -1,6 +1,5 @@ """Tests for tasks.py.""" -import os.path import re import sys import types @@ -1640,9 +1639,9 @@ class TaskTests(test_utils.TestCase): asyncio.coroutines._DEBUG = debug tb_filename = __file__ - tb_lineno = sys._getframe().f_lineno + 1 - coro = coro_noop() - coro = None + tb_lineno = sys._getframe().f_lineno + 2 + # create a coroutine object but don't use it + coro_noop() support.gc_collect() self.assertTrue(m_log.error.called) @@ -1652,7 +1651,7 @@ class TaskTests(test_utils.TestCase): r'Coroutine object created at \(most recent call last\):\n' r'.*\n' r' File "%s", line %s, in test_coroutine_never_yielded\n' - r' coro = coro_noop\(\)$' + r' coro_noop\(\)$' % (re.escape(coro_noop.__qualname__), re.escape(func_filename), func_lineno, re.escape(tb_filename), tb_lineno)) |