diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2017-12-26 09:53:38 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-26 09:53:38 (GMT) |
commit | a8f4e15f3d33084862ddd3a7d58cd00034e94f16 (patch) | |
tree | 954ecaaa41029b44440b11ac7c73c4b7f7b4e6a7 /Lib/test/test_asyncio/test_unix_events.py | |
parent | e0aef4f3cd339a405d2a7fbd35a50afa64834f84 (diff) | |
download | cpython-a8f4e15f3d33084862ddd3a7d58cd00034e94f16.zip cpython-a8f4e15f3d33084862ddd3a7d58cd00034e94f16.tar.gz cpython-a8f4e15f3d33084862ddd3a7d58cd00034e94f16.tar.bz2 |
bpo-26133: Fix typos (#5010)
* Fix typos
* Change warning text
* Add test
Diffstat (limited to 'Lib/test/test_asyncio/test_unix_events.py')
-rw-r--r-- | Lib/test/test_asyncio/test_unix_events.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_unix_events.py b/Lib/test/test_asyncio/test_unix_events.py index 097d0ef7..53ed3d9 100644 --- a/Lib/test/test_asyncio/test_unix_events.py +++ b/Lib/test/test_asyncio/test_unix_events.py @@ -229,6 +229,23 @@ class SelectorEventLoopSignalTests(test_utils.TestCase): self.assertEqual(len(self.loop._signal_handlers), 0) m_signal.set_wakeup_fd.assert_called_once_with(-1) + @mock.patch('asyncio.unix_events.sys') + @mock.patch('asyncio.unix_events.signal') + def test_close_on_finalizing(self, m_signal, m_sys): + m_signal.NSIG = signal.NSIG + self.loop.add_signal_handler(signal.SIGHUP, lambda: True) + + self.assertEqual(len(self.loop._signal_handlers), 1) + m_sys.is_finalizing.return_value = True + m_signal.signal.reset_mock() + + with self.assertWarnsRegex(ResourceWarning, + "skipping signal handlers removal"): + self.loop.close() + + self.assertEqual(len(self.loop._signal_handlers), 0) + self.assertFalse(m_signal.signal.called) + @unittest.skipUnless(hasattr(socket, 'AF_UNIX'), 'UNIX Sockets are not supported') |