FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.6] bpo-26133: Fix typos (GH-5010) by miss-islington · Pull Request #5014 · python/cpython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
4 changes: 2 additions & 2 deletions Lib/asyncio/unix_events.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
17 changes: 17 additions & 0 deletions Lib/test/test_asyncio/test_unix_events.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

Back | FazBrowse Home | New Git URL