mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
Fix check for run_in_executor on closed loop. (#4996)
This commit is contained in:
parent
a8fb079789
commit
a330f483e2
1 changed files with 7 additions and 3 deletions
|
@ -1842,14 +1842,18 @@ class EventLoopTestsMixin:
|
|||
self.loop.call_later(1.0, func)
|
||||
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:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue