diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-02-11 10:34:30 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-02-11 10:34:30 (GMT) |
commit | a125497ea302aff937a5c59f98c39dba4f1ab59b (patch) | |
tree | 3c4ef537c6bba46a544fefabae9b59c60a289c1b /Lib/asyncio/test_utils.py | |
parent | 1db2ba3a92a435e871800612a14a9dfc9e760fab (diff) | |
download | cpython-a125497ea302aff937a5c59f98c39dba4f1ab59b.zip cpython-a125497ea302aff937a5c59f98c39dba4f1ab59b.tar.gz cpython-a125497ea302aff937a5c59f98c39dba4f1ab59b.tar.bz2 |
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.
Diffstat (limited to 'Lib/asyncio/test_utils.py')
-rw-r--r-- | Lib/asyncio/test_utils.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/asyncio/test_utils.py b/Lib/asyncio/test_utils.py index 7c8e1dc..deab7c3 100644 --- a/Lib/asyncio/test_utils.py +++ b/Lib/asyncio/test_utils.py @@ -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) |