示例#1
0
    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)
示例#2
0
 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])
示例#3
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])
示例#4
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)