Esempio n. 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)
Esempio n. 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])
Esempio n. 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)
Esempio n. 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)
Esempio n. 5
0
 def test_setup_logging_helper_with_filename(self):
     _setup_logging(filename='TEMP')
     self.logging.config.dictConfig.assert_called_once_with(ANY)
Esempio n. 6
0
 def test_setup_logging_helper_both_filename_and_stream(self):
     with pytest.raises(AssertionError):
         _setup_logging(filename='TEMP', stream=Mock())
Esempio n. 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()])
Esempio n. 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()])
Esempio n. 9
0
 def test_setup_logging_helper_with_filename(self):
     logging._setup_logging(filename="TEMP")
     self.logging.basicConfig.assert_called_once_with(filename="TEMP")