Beispiel #1
0
 def test_setup_logging_helper_with_merge_config(self):
     _setup_logging(
         filename=None,
         stream=Mock(),
         logging_config={'merge': True, 'foo': 1},
     )
     self.logging.config.dictConfig.assert_called_once_with(ANY)
Beispiel #2
0
 def test_setup_logging_helper_with_stream(self):
     mock_handler = Mock()
     _setup_logging(
         filename=None,
         stream=Mock(),
         loghandlers=[mock_handler],
     )
     self.logging.config.dictConfig.assert_called_once_with(ANY)
     self.logging.root.handlers.extend.assert_called_once_with(
         [mock_handler])
Beispiel #3
0
 def test_setup_logging_helper_no_merge_config(self):
     _setup_logging(
         logging_config={'merge': False, 'foo': 1},
     )
     self.logging.config.dictConfig.assert_called_once_with(ANY)
Beispiel #4
0
 def test_setup_logging_helper_with_stream_no_handlers(self):
     _setup_logging(stream=Mock())
     self.logging.config.dictConfig.assert_called_once_with(ANY)
Beispiel #5
0
 def test_setup_logging_helper_with_filename(self):
     _setup_logging(filename='TEMP')
     self.logging.config.dictConfig.assert_called_once_with(ANY)
Beispiel #6
0
 def test_setup_logging_helper_both_filename_and_stream(self):
     with pytest.raises(AssertionError):
         _setup_logging(filename='TEMP', stream=Mock())
Beispiel #7
0
 def test_setup_logging_helper_with_stream(self):
     mock_handler = Mock()
     logging._setup_logging(stream=Mock(), handlers=[mock_handler])
     self.logging.basicConfig.assert_called_once_with(
         handlers=[mock_handler,
                   self.colorlog.StreamHandler()])
Beispiel #8
0
 def test_setup_logging_helper_with_stream_no_handlers(self):
     logging._setup_logging(stream=Mock())
     self.logging.basicConfig.assert_called_once_with(
         handlers=[self.colorlog.StreamHandler()])
Beispiel #9
0
 def test_setup_logging_helper_with_filename(self):
     logging._setup_logging(filename="TEMP")
     self.logging.basicConfig.assert_called_once_with(filename="TEMP")