def test_debug(self): "Test logger debug method" old_stdout = sys.stdout logger = PrintManager(self.name, verbose=2) sys.stdout = StringIO() logger.debug('test') result = sys.stdout.getvalue() expect = 'DEBUG %s:%s test\n' % (self.name, funcname()) self.assertEqual(expect, result) sys.stdout = old_stdout
def test_warning(self): "Test logger warning method" old_stdout = sys.stdout logger = PrintManager(self.name) # verbose is irrelevant sys.stdout = StringIO() logger.warning('test') result = sys.stdout.getvalue() expect = 'WARNING %s:%s test\n' % (self.name, funcname()) self.assertEqual(expect, result) sys.stdout = old_stdout
def test_info(self): "Test logger info method" old_stdout = sys.stdout logger = PrintManager(self.name, verbose=1) sys.stdout = StringIO() logger.info('test') result = sys.stdout.getvalue() expect = 'INFO %s:%s test\n' % (self.name, funcname()) self.assertEqual(expect, result) sys.stdout = old_stdout
def test_debug(self): "Test logger debug method" old_stdout = sys.stdout logger = PrintManager(self.name, verbose=2) sys.stdout = StringIO.StringIO() logger.debug('test') result = sys.stdout.getvalue() expect = 'DEBUG %s:%s test\n' % (self.name, funcname()) self.assertEqual(expect, result) sys.stdout = old_stdout
def test_error(self): "Test logger error method" old_stdout = sys.stdout logger = PrintManager(self.name) # verbose is irrelevant sys.stdout = StringIO() logger.error('test') result = sys.stdout.getvalue() expect = 'ERROR %s:%s test\n' % (self.name, funcname()) self.assertEqual(expect, result) sys.stdout = old_stdout
def test_info(self): "Test logger info method" old_stdout = sys.stdout logger = PrintManager(self.name, verbose=1) sys.stdout = StringIO.StringIO() logger.info('test') result = sys.stdout.getvalue() expect = 'INFO %s:%s test\n' % (self.name, funcname()) self.assertEqual(expect, result) sys.stdout = old_stdout
def test_warning(self): "Test logger warning method" old_stdout = sys.stdout logger = PrintManager(self.name) # verbose is irrelevant sys.stdout = StringIO.StringIO() logger.warning('test') result = sys.stdout.getvalue() expect = 'WARNING %s:%s test\n' % (self.name, funcname()) self.assertEqual(expect, result) sys.stdout = old_stdout
def test_error(self): "Test logger error method" old_stdout = sys.stdout logger = PrintManager(self.name) # verbose is irrelevant sys.stdout = StringIO.StringIO() logger.error('test') result = sys.stdout.getvalue() expect = 'ERROR %s:%s test\n' % (self.name, funcname()) self.assertEqual(expect, result) sys.stdout = old_stdout
def test_funcname(self): "Test funcname" result = funcname() expect = 'test_funcname' self.assertEqual(expect, result)