mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
asyncio: Add close() back to Unix selector event loop, to remove all signal handlers. Should fix buildbot issues.
This commit is contained in:
parent
79ed4c744a
commit
0b69fbc642
2 changed files with 21 additions and 0 deletions
|
@ -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):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue