diff options
author | Guido van Rossum <guido@python.org> | 2014-11-14 19:45:47 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2014-11-14 19:45:47 (GMT) |
commit | e36fcde38309f116c6c06042ad80e7debb7db743 (patch) | |
tree | f07b4d597d613ab70b2471f90f8c7e449de16ef2 /Lib/test | |
parent | 6c14f231005a2a3a63bd4b0157c908e94bd834ac (diff) | |
download | cpython-e36fcde38309f116c6c06042ad80e7debb7db743.zip cpython-e36fcde38309f116c6c06042ad80e7debb7db743.tar.gz cpython-e36fcde38309f116c6c06042ad80e7debb7db743.tar.bz2 |
- Issue #22841: Reject coroutines in asyncio add_signal_handler().
Patch by Ludovic.Gasc.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_asyncio/test_unix_events.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_unix_events.py b/Lib/test/test_asyncio/test_unix_events.py index e397598..2f3fa18 100644 --- a/Lib/test/test_asyncio/test_unix_events.py +++ b/Lib/test/test_asyncio/test_unix_events.py @@ -64,6 +64,18 @@ class SelectorEventLoopSignalTests(test_utils.TestCase): signal.SIGINT, lambda: True) @mock.patch('asyncio.unix_events.signal') + def test_add_signal_handler_coroutine_error(self, m_signal): + + @asyncio.coroutine + def simple_coroutine(): + yield from [] + + self.assertRaises( + TypeError, + self.loop.add_signal_handler, + signal.SIGINT, simple_coroutine) + + @mock.patch('asyncio.unix_events.signal') def test_add_signal_handler(self, m_signal): m_signal.NSIG = signal.NSIG |