diff options
author | Guido van Rossum <guido@dropbox.com> | 2013-11-07 04:25:50 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@dropbox.com> | 2013-11-07 04:25:50 (GMT) |
commit | 0b69fbc6420115ce11e7f18249280a2c6d9a87ce (patch) | |
tree | b626b482fa7e8901b64d15fcf1cd4ec1817380fb /Lib/test/test_asyncio | |
parent | 79ed4c744a0dc67941f539b3a7883dfe80ca24e8 (diff) | |
download | cpython-0b69fbc6420115ce11e7f18249280a2c6d9a87ce.zip cpython-0b69fbc6420115ce11e7f18249280a2c6d9a87ce.tar.gz cpython-0b69fbc6420115ce11e7f18249280a2c6d9a87ce.tar.bz2 |
asyncio: Add close() back to Unix selector event loop, to remove all signal handlers. Should fix buildbot issues.
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r-- | Lib/test/test_asyncio/test_unix_events.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_unix_events.py b/Lib/test/test_asyncio/test_unix_events.py index a4d835e..42eba8d 100644 --- a/Lib/test/test_asyncio/test_unix_events.py +++ b/Lib/test/test_asyncio/test_unix_events.py @@ -183,6 +183,22 @@ class SelectorEventLoopTests(unittest.TestCase): self.assertRaises( RuntimeError, self.loop.remove_signal_handler, signal.SIGHUP) + @unittest.mock.patch('asyncio.unix_events.signal') + def test_close(self, m_signal): + m_signal.NSIG = signal.NSIG + + self.loop.add_signal_handler(signal.SIGHUP, lambda: True) + self.loop.add_signal_handler(signal.SIGCHLD, lambda: True) + + self.assertEqual(len(self.loop._signal_handlers), 2) + + m_signal.set_wakeup_fd.reset_mock() + + self.loop.close() + + self.assertEqual(len(self.loop._signal_handlers), 0) + m_signal.set_wakeup_fd.assert_called_once_with(-1) + class UnixReadPipeTransportTests(unittest.TestCase): |