summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2017-12-23 21:03:27 (GMT)
committerGitHub <noreply@github.com>2017-12-23 21:03:27 (GMT)
commita330f483e2d05f3ad1780f0542ecd8d2b0dda5df (patch)
tree0485173e5e9f0dd861ac1be7210c6e986f59498c
parenta8fb07978953d3f55cfce836e3669d8b8e82b4c1 (diff)
downloadcpython-a330f483e2d05f3ad1780f0542ecd8d2b0dda5df.zip
cpython-a330f483e2d05f3ad1780f0542ecd8d2b0dda5df.tar.gz
cpython-a330f483e2d05f3ad1780f0542ecd8d2b0dda5df.tar.bz2
Fix check for run_in_executor on closed loop. (#4996)
-rw-r--r--Lib/test/test_asyncio/test_events.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
index e5e41fc..79e8d79 100644
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -1843,13 +1843,17 @@ class EventLoopTestsMixin:
with self.assertRaises(RuntimeError):
self.loop.call_at(self.loop.time() + .0, func)
with self.assertRaises(RuntimeError):
- self.loop.run_until_complete(
- self.loop.run_in_executor(None, func))
- with self.assertRaises(RuntimeError):
self.loop.create_task(coro)
with self.assertRaises(RuntimeError):
self.loop.add_signal_handler(signal.SIGTERM, func)
+ # run_in_executor test is tricky: the method is a coroutine,
+ # but run_until_complete cannot be called on closed loop.
+ # Thus iterate once explicitly.
+ with self.assertRaises(RuntimeError):
+ it = self.loop.run_in_executor(None, func).__await__()
+ next(it)
+
class SubprocessTestsMixin: