def test_adds_both_handlers_correctly(self): main.setup_logging("WARN", "testfile", "DEBUG") assert len(main.logging.rt.handlers) == 2 if isinstance(main.logging.rt.handlers[0], main.logging.StreamHandler): sh = main.logging.rt.handlers[0] fh = main.logging.rt.handlers[1] else: fh = main.logging.rt.handlers[0] sh = main.logging.rt.handlers[1] self.check_stderr_handler(sh) self.check_file_handler(fh)
def test_adds_stderr_handler_correctly(self): main.setup_logging("WARN", None, None) assert main.logging.rt.level == logging.DEBUG assert len(main.logging.rt.handlers) == 1 self.check_stderr_handler(main.logging.rt.handlers[0])
def test_adds_file_handler_correctly(self): main.setup_logging(None, "testfile", "DEBUG") assert main.logging.rt.level == logging.DEBUG assert len(main.logging.rt.handlers) == 1 self.check_file_handler(main.logging.rt.handlers[0])
def test_adds_atleast_null_handler(self): main.setup_logging(None, None, None) assert len(main.logging.rt.handlers) == 1 assert isinstance(main.logging.rt.handlers[0], main.null_logger)