def test_logging_dictConfig(self, m_logging_config, config): scheduler._configure_logging(config) if "publisher" in config["logging"]: m_logging_config.dictConfig.assert_called_once_with( config["logging"]["publisher"] ) else: m_logging_config.dictConfig.assert_called_once_with(config["logging"])
def test_zmq_handler_formatters(self, m_logger, m_logging, m_logging_config): m_handler = Mock(name="m_zmq_handler", spec=zmq.log.handlers.PUBHandler) m_logger.root = Mock(handlers=[m_handler]) scheduler._configure_logging(self.zmq_logging_config) expected = { m_logging.DEBUG: m_logging.Formatter("%(message)s\n"), m_logging.INFO: m_logging.Formatter("%(message)s\n"), m_logging.WARNING: m_logging.Formatter("%(message)s\n"), m_logging.ERROR: m_logging.Formatter("%(message)s\n"), m_logging.CRITICAL: m_logging.Formatter("%(message)s\n"), } assert m_handler.formatters == expected
def test_change_rotating_logger_handler_to_watched(self, m_logging_config): scheduler._configure_logging(self.filesystem_logging_config) handler = self.filesystem_logging_config["logging"]["handlers"]["info_text"] assert handler["class"] == "logging.handlers.WatchedFileHandler" assert "backupCount" not in handler
def test_zmq_handler_root_topic(self, m_logger, m_logging_config): m_handler = Mock(name="m_zmq_handler", spec=zmq.log.handlers.PUBHandler) m_logger.root = Mock(handlers=[m_handler]) scheduler._configure_logging(self.zmq_logging_config) assert m_handler.root_topic == "scheduler"
def test_msg(self, m_logging_config, config, exp_msg): msg = scheduler._configure_logging(config) assert msg == exp_msg