Rename the logger to plain "logger".

This commit is contained in:
Guido van Rossum 2013-10-17 15:39:45 -07:00
parent b795aa8547
commit fc29e0f37e
15 changed files with 61 additions and 60 deletions

View file

@ -183,7 +183,7 @@ class BaseEventLoopTests(unittest.TestCase):
self.assertTrue(self.loop._process_events.called)
@unittest.mock.patch('asyncio.base_events.time')
@unittest.mock.patch('asyncio.base_events.asyncio_log')
@unittest.mock.patch('asyncio.base_events.logger')
def test__run_once_logging(self, m_logging, m_time):
# Log to INFO level if timeout > 1.0 sec.
idx = -1
@ -579,7 +579,7 @@ class BaseEventLoopWithSelectorTests(unittest.TestCase):
self.loop._accept_connection(MyProto, sock)
self.assertFalse(sock.close.called)
@unittest.mock.patch('asyncio.selector_events.asyncio_log')
@unittest.mock.patch('asyncio.selector_events.logger')
def test_accept_connection_exception(self, m_log):
sock = unittest.mock.Mock()
sock.fileno.return_value = 10

View file

@ -1320,7 +1320,7 @@ class HandleTests(unittest.TestCase):
self.assertRaises(
AssertionError, events.make_handle, h1, ())
@unittest.mock.patch('asyncio.events.asyncio_log')
@unittest.mock.patch('asyncio.events.logger')
def test_callback_with_exception(self, log):
def callback():
raise ValueError()

View file

@ -170,20 +170,20 @@ class FutureTests(unittest.TestCase):
self.assertRaises(AssertionError, test)
fut.cancel()
@unittest.mock.patch('asyncio.futures.asyncio_log')
@unittest.mock.patch('asyncio.futures.logger')
def test_tb_logger_abandoned(self, m_log):
fut = futures.Future(loop=self.loop)
del fut
self.assertFalse(m_log.error.called)
@unittest.mock.patch('asyncio.futures.asyncio_log')
@unittest.mock.patch('asyncio.futures.logger')
def test_tb_logger_result_unretrieved(self, m_log):
fut = futures.Future(loop=self.loop)
fut.set_result(42)
del fut
self.assertFalse(m_log.error.called)
@unittest.mock.patch('asyncio.futures.asyncio_log')
@unittest.mock.patch('asyncio.futures.logger')
def test_tb_logger_result_retrieved(self, m_log):
fut = futures.Future(loop=self.loop)
fut.set_result(42)
@ -191,7 +191,7 @@ class FutureTests(unittest.TestCase):
del fut
self.assertFalse(m_log.error.called)
@unittest.mock.patch('asyncio.futures.asyncio_log')
@unittest.mock.patch('asyncio.futures.logger')
def test_tb_logger_exception_unretrieved(self, m_log):
fut = futures.Future(loop=self.loop)
fut.set_exception(RuntimeError('boom'))
@ -199,7 +199,7 @@ class FutureTests(unittest.TestCase):
test_utils.run_briefly(self.loop)
self.assertTrue(m_log.error.called)
@unittest.mock.patch('asyncio.futures.asyncio_log')
@unittest.mock.patch('asyncio.futures.logger')
def test_tb_logger_exception_retrieved(self, m_log):
fut = futures.Future(loop=self.loop)
fut.set_exception(RuntimeError('boom'))
@ -207,7 +207,7 @@ class FutureTests(unittest.TestCase):
del fut
self.assertFalse(m_log.error.called)
@unittest.mock.patch('asyncio.futures.asyncio_log')
@unittest.mock.patch('asyncio.futures.logger')
def test_tb_logger_exception_result_retrieved(self, m_log):
fut = futures.Future(loop=self.loop)
fut.set_exception(RuntimeError('boom'))

View file

@ -135,7 +135,7 @@ class ProactorSocketTransportTests(unittest.TestCase):
self.loop._proactor.send.return_value.add_done_callback.\
assert_called_with(tr._loop_writing)
@unittest.mock.patch('asyncio.proactor_events.asyncio_log')
@unittest.mock.patch('asyncio.proactor_events.logger')
def test_loop_writing_err(self, m_log):
err = self.loop._proactor.send.side_effect = OSError()
tr = _ProactorSocketTransport(self.loop, self.sock, self.protocol)
@ -207,7 +207,7 @@ class ProactorSocketTransportTests(unittest.TestCase):
test_utils.run_briefly(self.loop)
self.assertFalse(self.protocol.connection_lost.called)
@unittest.mock.patch('asyncio.proactor_events.asyncio_log')
@unittest.mock.patch('asyncio.proactor_events.logger')
def test_fatal_error(self, m_logging):
tr = _ProactorSocketTransport(self.loop, self.sock, self.protocol)
tr._force_close = unittest.mock.Mock()
@ -432,7 +432,7 @@ class BaseProactorEventLoopTests(unittest.TestCase):
def test_process_events(self):
self.loop._process_events([])
@unittest.mock.patch('asyncio.proactor_events.asyncio_log')
@unittest.mock.patch('asyncio.proactor_events.logger')
def test_create_server(self, m_log):
pf = unittest.mock.Mock()
call_soon = self.loop.call_soon = unittest.mock.Mock()

View file

@ -626,7 +626,7 @@ class SelectorTransportTests(unittest.TestCase):
self.assertFalse(self.loop.readers)
self.assertEqual(1, self.loop.remove_reader_count[7])
@unittest.mock.patch('asyncio.log.asyncio_log.exception')
@unittest.mock.patch('asyncio.log.logger.exception')
def test_fatal_error(self, m_exc):
exc = OSError()
tr = _SelectorTransport(self.loop, self.sock, self.protocol, None)
@ -823,7 +823,7 @@ class SelectorSocketTransportTests(unittest.TestCase):
self.loop.assert_writer(7, transport._write_ready)
self.assertEqual(collections.deque([b'data']), transport._buffer)
@unittest.mock.patch('asyncio.selector_events.asyncio_log')
@unittest.mock.patch('asyncio.selector_events.logger')
def test_write_exception(self, m_log):
err = self.sock.send.side_effect = OSError()
@ -937,7 +937,7 @@ class SelectorSocketTransportTests(unittest.TestCase):
transport._write_ready()
transport._fatal_error.assert_called_with(err)
@unittest.mock.patch('asyncio.selector_events.asyncio_log')
@unittest.mock.patch('asyncio.selector_events.logger')
def test_write_ready_exception_and_close(self, m_log):
self.sock.send.side_effect = OSError()
remove_writer = self.loop.remove_writer = unittest.mock.Mock()
@ -1072,7 +1072,7 @@ class SelectorSslTransportTests(unittest.TestCase):
transport.write(b'data')
self.assertEqual(transport._conn_lost, 2)
@unittest.mock.patch('asyncio.selector_events.asyncio_log')
@unittest.mock.patch('asyncio.selector_events.logger')
def test_write_exception(self, m_log):
transport = self._make_one()
transport._conn_lost = 1
@ -1325,7 +1325,7 @@ class SelectorDatagramTransportTests(unittest.TestCase):
self.assertEqual(
[(b'data', ('0.0.0.0', 12345))], list(transport._buffer))
@unittest.mock.patch('asyncio.selector_events.asyncio_log')
@unittest.mock.patch('asyncio.selector_events.logger')
def test_sendto_exception(self, m_log):
data = b'data'
err = self.sock.sendto.side_effect = OSError()
@ -1475,7 +1475,7 @@ class SelectorDatagramTransportTests(unittest.TestCase):
self.assertTrue(transport._fatal_error.called)
@unittest.mock.patch('asyncio.log.asyncio_log.exception')
@unittest.mock.patch('asyncio.log.logger.exception')
def test_fatal_error_connected(self, m_exc):
transport = _SelectorDatagramTransport(
self.loop, self.sock, self.protocol, ('0.0.0.0', 1))

View file

@ -87,7 +87,7 @@ class SelectorEventLoopTests(unittest.TestCase):
signal.SIGINT, lambda: True)
@unittest.mock.patch('asyncio.unix_events.signal')
@unittest.mock.patch('asyncio.unix_events.asyncio_log')
@unittest.mock.patch('asyncio.unix_events.logger')
def test_add_signal_handler_install_error2(self, m_logging, m_signal):
m_signal.NSIG = signal.NSIG
@ -104,7 +104,7 @@ class SelectorEventLoopTests(unittest.TestCase):
self.assertEqual(1, m_signal.set_wakeup_fd.call_count)
@unittest.mock.patch('asyncio.unix_events.signal')
@unittest.mock.patch('asyncio.unix_events.asyncio_log')
@unittest.mock.patch('asyncio.unix_events.logger')
def test_add_signal_handler_install_error3(self, m_logging, m_signal):
class Err(OSError):
errno = errno.EINVAL
@ -149,7 +149,7 @@ class SelectorEventLoopTests(unittest.TestCase):
m_signal.signal.call_args[0])
@unittest.mock.patch('asyncio.unix_events.signal')
@unittest.mock.patch('asyncio.unix_events.asyncio_log')
@unittest.mock.patch('asyncio.unix_events.logger')
def test_remove_signal_handler_cleanup_error(self, m_logging, m_signal):
m_signal.NSIG = signal.NSIG
self.loop.add_signal_handler(signal.SIGHUP, lambda: True)
@ -270,7 +270,7 @@ class SelectorEventLoopTests(unittest.TestCase):
self.assertFalse(m_WEXITSTATUS.called)
self.assertFalse(m_WTERMSIG.called)
@unittest.mock.patch('asyncio.unix_events.asyncio_log')
@unittest.mock.patch('asyncio.unix_events.logger')
@unittest.mock.patch('os.WTERMSIG')
@unittest.mock.patch('os.WEXITSTATUS')
@unittest.mock.patch('os.WIFSIGNALED')
@ -360,7 +360,7 @@ class UnixReadPipeTransportTests(unittest.TestCase):
test_utils.run_briefly(self.loop)
self.assertFalse(self.protocol.data_received.called)
@unittest.mock.patch('asyncio.log.asyncio_log.exception')
@unittest.mock.patch('asyncio.log.logger.exception')
@unittest.mock.patch('os.read')
def test__read_ready_error(self, m_read, m_logexc):
tr = unix_events._UnixReadPipeTransport(
@ -550,7 +550,7 @@ class UnixWritePipeTransportTests(unittest.TestCase):
self.loop.assert_writer(5, tr._write_ready)
self.assertEqual([b'data'], tr._buffer)
@unittest.mock.patch('asyncio.unix_events.asyncio_log')
@unittest.mock.patch('asyncio.unix_events.logger')
@unittest.mock.patch('os.write')
def test_write_err(self, m_write, m_log):
tr = unix_events._UnixWritePipeTransport(
@ -648,7 +648,7 @@ class UnixWritePipeTransportTests(unittest.TestCase):
self.loop.assert_writer(5, tr._write_ready)
self.assertEqual([b'data'], tr._buffer)
@unittest.mock.patch('asyncio.log.asyncio_log.exception')
@unittest.mock.patch('asyncio.log.logger.exception')
@unittest.mock.patch('os.write')
def test__write_ready_err(self, m_write, m_logexc):
tr = unix_events._UnixWritePipeTransport(