mirror of https://github.com/python/cpython.git
asyncio: Cosmetic improvement to test__run_once_logging() mock argument.
This commit is contained in:
parent
3c9bb69fa1
commit
3b55f0c622
|
@ -190,7 +190,7 @@ def test__run_once(self):
|
||||||
|
|
||||||
@unittest.mock.patch('asyncio.base_events.time')
|
@unittest.mock.patch('asyncio.base_events.time')
|
||||||
@unittest.mock.patch('asyncio.base_events.logger')
|
@unittest.mock.patch('asyncio.base_events.logger')
|
||||||
def test__run_once_logging(self, m_logging, m_time):
|
def test__run_once_logging(self, m_logger, m_time):
|
||||||
# Log to INFO level if timeout > 1.0 sec.
|
# Log to INFO level if timeout > 1.0 sec.
|
||||||
idx = -1
|
idx = -1
|
||||||
data = [10.0, 10.0, 12.0, 13.0]
|
data = [10.0, 10.0, 12.0, 13.0]
|
||||||
|
@ -201,20 +201,18 @@ def monotonic():
|
||||||
return data[idx]
|
return data[idx]
|
||||||
|
|
||||||
m_time.monotonic = monotonic
|
m_time.monotonic = monotonic
|
||||||
m_logging.INFO = logging.INFO
|
|
||||||
m_logging.DEBUG = logging.DEBUG
|
|
||||||
|
|
||||||
self.loop._scheduled.append(
|
self.loop._scheduled.append(
|
||||||
asyncio.TimerHandle(11.0, lambda: True, ()))
|
asyncio.TimerHandle(11.0, lambda: True, ()))
|
||||||
self.loop._process_events = unittest.mock.Mock()
|
self.loop._process_events = unittest.mock.Mock()
|
||||||
self.loop._run_once()
|
self.loop._run_once()
|
||||||
self.assertEqual(logging.INFO, m_logging.log.call_args[0][0])
|
self.assertEqual(logging.INFO, m_logger.log.call_args[0][0])
|
||||||
|
|
||||||
idx = -1
|
idx = -1
|
||||||
data = [10.0, 10.0, 10.3, 13.0]
|
data = [10.0, 10.0, 10.3, 13.0]
|
||||||
self.loop._scheduled = [asyncio.TimerHandle(11.0, lambda:True, ())]
|
self.loop._scheduled = [asyncio.TimerHandle(11.0, lambda:True, ())]
|
||||||
self.loop._run_once()
|
self.loop._run_once()
|
||||||
self.assertEqual(logging.DEBUG, m_logging.log.call_args[0][0])
|
self.assertEqual(logging.DEBUG, m_logger.log.call_args[0][0])
|
||||||
|
|
||||||
def test__run_once_schedule_handle(self):
|
def test__run_once_schedule_handle(self):
|
||||||
handle = None
|
handle = None
|
||||||
|
|
Loading…
Reference in New Issue