[Python-checkins] bpo-26133: Fix typos (GH-5010) (#5014)

Andrew Svetlov webhook-mailer at python.org
Tue Dec 26 05:29:36 EST 2017


https://github.com/python/cpython/commit/32518b439b9590cce0ef0639e558dc1ce2e152bb
commit: 32518b439b9590cce0ef0639e558dc1ce2e152bb
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Andrew Svetlov <andrew.svetlov at gmail.com>
date: 2017年12月26日T12:29:29+02:00
summary:
bpo-26133: Fix typos (GH-5010) (#5014)
* Fix typos
* Change warning text
* Add test
(cherry picked from commit a8f4e15f3d33084862ddd3a7d58cd00034e94f16)
files:
M Lib/asyncio/unix_events.py
M Lib/test/test_asyncio/test_unix_events.py
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py
index 70b7050d9b7..b18824fd33b 100644
--- a/Lib/asyncio/unix_events.py
+++ b/Lib/asyncio/unix_events.py
@@ -66,9 +66,9 @@ def close(self):
 self.remove_signal_handler(sig)
 else:
 if self._signal_handlers:
- warinigs.warn(f"Closing the loop {self!r} "
+ warnings.warn(f"Closing the loop {self!r} "
 f"on interpreter shutdown "
- f"stage, signal unsubsription is disabled",
+ f"stage, skipping signal handlers removal",
 ResourceWarning,
 source=self)
 self._signal_handlers.clear()
diff --git a/Lib/test/test_asyncio/test_unix_events.py b/Lib/test/test_asyncio/test_unix_events.py
index 5a499841352..868751bdedc 100644
--- a/Lib/test/test_asyncio/test_unix_events.py
+++ b/Lib/test/test_asyncio/test_unix_events.py
@@ -230,6 +230,23 @@ def test_close(self, m_signal):
 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')


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /