mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #25593: Change semantics of EventLoop.stop().
This commit is contained in:
parent
01a65af4a1
commit
41f69f4cc7
6 changed files with 87 additions and 28 deletions
|
@ -71,12 +71,13 @@ def run_until(loop, pred, timeout=30):
|
|||
|
||||
|
||||
def run_once(loop):
|
||||
"""loop.stop() schedules _raise_stop_error()
|
||||
and run_forever() runs until _raise_stop_error() callback.
|
||||
this wont work if test waits for some IO events, because
|
||||
_raise_stop_error() runs before any of io events callbacks.
|
||||
"""Legacy API to run once through the event loop.
|
||||
|
||||
This is the recommended pattern for test code. It will poll the
|
||||
selector once and run all callbacks scheduled in response to I/O
|
||||
events.
|
||||
"""
|
||||
loop.stop()
|
||||
loop.call_soon(loop.stop)
|
||||
loop.run_forever()
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue