From 7ce1c6fb579a01bb184224a10019039fde9c8eaf Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Sun, 11 Jun 2017 13:49:18 +0000 Subject: bpo-30508: Don't log exceptions if Task/Future "cancel()" method called (#2050) --- Lib/test/test_asyncio/test_futures.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Lib/test/test_asyncio/test_futures.py') diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py index 99336f86ab..5d4b2d2aa0 100644 --- a/Lib/test/test_asyncio/test_futures.py +++ b/Lib/test/test_asyncio/test_futures.py @@ -318,6 +318,14 @@ class BaseFutureTests: del fut self.assertFalse(m_log.error.called) + @mock.patch('asyncio.base_events.logger') + def test_tb_logger_not_called_after_cancel(self, m_log): + fut = self._new_future(loop=self.loop) + fut.set_exception(Exception()) + fut.cancel() + del fut + self.assertFalse(m_log.error.called) + @mock.patch('asyncio.base_events.logger') def test_tb_logger_result_unretrieved(self, m_log): fut = self._new_future(loop=self.loop) -- cgit v1.2.1