mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
asyncio: New error handling API. Issue #20681.
This commit is contained in:
parent
065efc3072
commit
ff827f08ac
15 changed files with 491 additions and 99 deletions
|
@ -174,20 +174,20 @@ class FutureTests(unittest.TestCase):
|
|||
self.assertRaises(AssertionError, test)
|
||||
fut.cancel()
|
||||
|
||||
@unittest.mock.patch('asyncio.futures.logger')
|
||||
@unittest.mock.patch('asyncio.base_events.logger')
|
||||
def test_tb_logger_abandoned(self, m_log):
|
||||
fut = asyncio.Future(loop=self.loop)
|
||||
del fut
|
||||
self.assertFalse(m_log.error.called)
|
||||
|
||||
@unittest.mock.patch('asyncio.futures.logger')
|
||||
@unittest.mock.patch('asyncio.base_events.logger')
|
||||
def test_tb_logger_result_unretrieved(self, m_log):
|
||||
fut = asyncio.Future(loop=self.loop)
|
||||
fut.set_result(42)
|
||||
del fut
|
||||
self.assertFalse(m_log.error.called)
|
||||
|
||||
@unittest.mock.patch('asyncio.futures.logger')
|
||||
@unittest.mock.patch('asyncio.base_events.logger')
|
||||
def test_tb_logger_result_retrieved(self, m_log):
|
||||
fut = asyncio.Future(loop=self.loop)
|
||||
fut.set_result(42)
|
||||
|
@ -195,7 +195,7 @@ class FutureTests(unittest.TestCase):
|
|||
del fut
|
||||
self.assertFalse(m_log.error.called)
|
||||
|
||||
@unittest.mock.patch('asyncio.futures.logger')
|
||||
@unittest.mock.patch('asyncio.base_events.logger')
|
||||
def test_tb_logger_exception_unretrieved(self, m_log):
|
||||
fut = asyncio.Future(loop=self.loop)
|
||||
fut.set_exception(RuntimeError('boom'))
|
||||
|
@ -203,7 +203,7 @@ class FutureTests(unittest.TestCase):
|
|||
test_utils.run_briefly(self.loop)
|
||||
self.assertTrue(m_log.error.called)
|
||||
|
||||
@unittest.mock.patch('asyncio.futures.logger')
|
||||
@unittest.mock.patch('asyncio.base_events.logger')
|
||||
def test_tb_logger_exception_retrieved(self, m_log):
|
||||
fut = asyncio.Future(loop=self.loop)
|
||||
fut.set_exception(RuntimeError('boom'))
|
||||
|
@ -211,7 +211,7 @@ class FutureTests(unittest.TestCase):
|
|||
del fut
|
||||
self.assertFalse(m_log.error.called)
|
||||
|
||||
@unittest.mock.patch('asyncio.futures.logger')
|
||||
@unittest.mock.patch('asyncio.base_events.logger')
|
||||
def test_tb_logger_exception_result_retrieved(self, m_log):
|
||||
fut = asyncio.Future(loop=self.loop)
|
||||
fut.set_exception(RuntimeError('boom'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue