summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2015-12-11 16:33:59 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2015-12-11 16:33:59 (GMT)
commit0ac3a0cd7932079724aaabbb0a078e1c17129068 (patch)
tree5aa52402d3fde41233b91ca88a04c03d6d6ed343 /Lib/test
parentdddc781998da741511178c7cb4e303e3db5aac45 (diff)
downloadcpython-0ac3a0cd7932079724aaabbb0a078e1c17129068.zip
cpython-0ac3a0cd7932079724aaabbb0a078e1c17129068.tar.gz
cpython-0ac3a0cd7932079724aaabbb0a078e1c17129068.tar.bz2
asyncio: Make Tasks check if Futures are attached to the same event loop
See https://github.com/python/asyncio/pull/303 for details
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_asyncio/test_tasks.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py
index 04d19ac..47b17d1 100644
--- a/Lib/test/test_asyncio/test_tasks.py
+++ b/Lib/test/test_asyncio/test_tasks.py
@@ -76,6 +76,21 @@ class TaskTests(test_utils.TestCase):
def setUp(self):
self.loop = self.new_test_loop()
+ def test_other_loop_future(self):
+ other_loop = asyncio.new_event_loop()
+ fut = asyncio.Future(loop=other_loop)
+
+ @asyncio.coroutine
+ def run(fut):
+ yield from fut
+
+ try:
+ with self.assertRaisesRegex(RuntimeError,
+ r'Task .* got Future .* attached'):
+ self.loop.run_until_complete(run(fut))
+ finally:
+ other_loop.close()
+
def test_task_class(self):
@asyncio.coroutine
def notmuch():