def test_colorize_auto_nontty(self): # with colorize=Colorize.AUTO on a stream *not* connected to a TTY, # return colorizing formatter stream = open(os.devnull, 'w') cls = fancylogger._screenLogFormatterFactory(fancylogger.Colorize.AUTO, stream) self.assertEqual(cls, logging.Formatter)
def test_colorize_auto_tty(self): # with colorize=Colorize.AUTO on a stream connected to a TTY, # return colorizing formatter stream = _get_tty_stream() cls = fancylogger._screenLogFormatterFactory(fancylogger.Colorize.AUTO, stream) self.assertEqual(cls, coloredlogs.ColoredFormatter)
def test_colorize_always(self): # with colorize=Colorize.ALWAYS, return colorizing formatter cls = fancylogger._screenLogFormatterFactory( fancylogger.Colorize.ALWAYS) self.assertEqual(cls, coloredlogs.ColoredFormatter)
def test_colorize_never(self): # with colorize=Colorize.NEVER, return plain old formatter cls = fancylogger._screenLogFormatterFactory( fancylogger.Colorize.NEVER) self.assertEqual(cls, logging.Formatter)
def test_colorize_always(self): # with colorize=Colorize.ALWAYS, return colorizing formatter cls = fancylogger._screenLogFormatterFactory(fancylogger.Colorize.ALWAYS) self.assertEqual(cls, coloredlogs.ColoredFormatter)
def test_colorize_never(self): # with colorize=Colorize.NEVER, return plain old formatter cls = fancylogger._screenLogFormatterFactory(fancylogger.Colorize.NEVER) self.assertEqual(cls, logging.Formatter)