bpo-30508: Don't log exceptions if Task/Future "cancel()" method called (#2050)

This commit is contained in:
Yury Selivanov 2017-06-11 13:49:18 +00:00 committed by GitHub
parent 36ff451eba
commit 7ce1c6fb57
6 changed files with 49 additions and 1 deletions

View file

@ -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)