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

This commit is contained in:
Yury Selivanov 2017-06-11 14:00:14 +00:00 committed by GitHub
parent 59422a29ee
commit 176f2ebdad
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)