예제 #1
0
 def test_header2(self):
     name = logger.get_logfile()
     testline = 'Testing header2'
     logger.header2(testline)
     logger.teardown()
     self.__file = open(name, 'r')
     line = self.compline()
     self.__file.close()
     logger.teardown()
     self.assertEqual(line[:len(testline)], testline)
예제 #2
0
 def test_success(self):
     name = logger.get_logfile()
     testline = 'Testing success'
     logger.success(testline)
     logger.teardown()
     self.__file = open(name, 'r')
     line = self.compline()
     logger.teardown()
     self.__file.close()
     self.assertEqual(line[:len(testline)], testline)
예제 #3
0
 def test_failure(self):
     name = logger.get_logfile()
     testline = 'Testing failure'
     logger.failure(testline)
     logger.teardown()
     self.__file = open(name, 'r')
     line = self.compline()
     logger.teardown()
     self.__file.close()
     self.assertEqual(line[:len(testline)], testline)
예제 #4
0
    def test_decorator(self):
        @logger.decorator(style='debug')
        def test(*args, **kwargs):
            return args, kwargs

        _t = test(1, one=1)
        name = logger.get_logfile()
        logger.teardown()
        self.__file = open(name, 'r')
        line = self.compline(1)
        logger.teardown()
        self.__file.close()
        testline = '''Called <test> with params: (1,), {'one': 1}'''
        self.assertEqual(line[:len(testline)], testline)
예제 #5
0
 def setUp(self):
     self.__settings = {
         'append': False,
         'verbosity': 3,
         'use_colour': True,
         'structure_string': "",
         'add_timestamp': True,
         'logfile': f'tests/logger/test-setup',
         'suppress_terminal': True
     }
     logger.setup(**self.__settings)
     logger.teardown()
     name = logger.get_logfile()
     self.__file = open(name, 'r')
     line = self.compline()
     testline = 'The logger'
     self.__file.close()
     self.assertEqual(line[:len(testline)], testline)