mirror of
https://github.com/python/cpython.git
synced 2025-07-13 06:15:17 +00:00
asyncio, Tulip issue 126: call_soon(), call_soon_threadsafe(), call_later(),
call_at() and run_in_executor() now raise a TypeError if the callback is a coroutine function.
This commit is contained in:
parent
1db2ba3a92
commit
a125497ea3
6 changed files with 39 additions and 13 deletions
|
@ -135,7 +135,7 @@ def make_test_protocol(base):
|
|||
if name.startswith('__') and name.endswith('__'):
|
||||
# skip magic names
|
||||
continue
|
||||
dct[name] = unittest.mock.Mock(return_value=None)
|
||||
dct[name] = MockCallback(return_value=None)
|
||||
return type('TestProtocol', (base,) + base.__bases__, dct)()
|
||||
|
||||
|
||||
|
@ -274,3 +274,6 @@ class TestLoop(base_events.BaseEventLoop):
|
|||
|
||||
def _write_to_self(self):
|
||||
pass
|
||||
|
||||
def MockCallback(**kwargs):
|
||||
return unittest.mock.Mock(spec=['__call__'], **kwargs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue