summaryrefslogtreecommitdiff
path: root/Lib/test/test_asyncio/test_base_events.py
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2016-10-05 18:28:09 -0400
committerYury Selivanov <yury@magic.io>2016-10-05 18:28:09 -0400
commitb0010bc3364b14082dfbfcdf1b5e9a16e06458db (patch)
tree599371ce0684e27865a478fe207bb6d3ba887258 /Lib/test/test_asyncio/test_base_events.py
parent0b0470b415d11d75ba8f43d1aa19f0b1c2cf4696 (diff)
downloadcpython-b0010bc3364b14082dfbfcdf1b5e9a16e06458db.tar.gz
Issue #28371: Deprecate passing asyncio.Handles to run_in_executor.
Diffstat (limited to 'Lib/test/test_asyncio/test_base_events.py')
-rw-r--r--Lib/test/test_asyncio/test_base_events.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py
index 362ab06f39..a9aba0ffb6 100644
--- a/Lib/test/test_asyncio/test_base_events.py
+++ b/Lib/test/test_asyncio/test_base_events.py
@@ -358,7 +358,8 @@ class BaseEventLoopTests(test_utils.TestCase):
h = asyncio.Handle(cb, (), self.loop)
h.cancel()
- f = self.loop.run_in_executor(None, h)
+ with self.assertWarnsRegex(DeprecationWarning, "Passing Handle"):
+ f = self.loop.run_in_executor(None, h)
self.assertIsInstance(f, asyncio.Future)
self.assertTrue(f.done())
self.assertIsNone(f.result())
@@ -373,12 +374,14 @@ class BaseEventLoopTests(test_utils.TestCase):
self.loop.set_default_executor(executor)
- res = self.loop.run_in_executor(None, h)
+ with self.assertWarnsRegex(DeprecationWarning, "Passing Handle"):
+ res = self.loop.run_in_executor(None, h)
self.assertIs(f, res)
executor = mock.Mock()
executor.submit.return_value = f
- res = self.loop.run_in_executor(executor, h)
+ with self.assertWarnsRegex(DeprecationWarning, "Passing Handle"):
+ res = self.loop.run_in_executor(executor, h)
self.assertIs(f, res)
self.assertTrue(executor.submit.called)