예제 #1
0
    def test_output_std_out(self):
        output = StringIO()
        log = Logger('test')
        saved_stdout = sys.stdout
        sys.stdout = output
        log.info("Testing")
        sys.stdout = saved_stdout

        assert output.getvalue().rstrip() == "[test] INFO: Testing"
예제 #2
0
    def test_create_logger_with_file(self):
        log = Logger('test', file_name=self.test_path / 'test_file.log')
        log.info('Testing')

        assert (self.test_path / 'test_file.log').exists()