예제 #1
0
 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)
예제 #2
0
 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)
예제 #3
0
 def test_colorize_always(self):
     # with colorize=Colorize.ALWAYS, return colorizing formatter
     cls = fancylogger._screenLogFormatterFactory(
         fancylogger.Colorize.ALWAYS)
     self.assertEqual(cls, coloredlogs.ColoredFormatter)
예제 #4
0
 def test_colorize_never(self):
     # with colorize=Colorize.NEVER, return plain old formatter
     cls = fancylogger._screenLogFormatterFactory(
         fancylogger.Colorize.NEVER)
     self.assertEqual(cls, logging.Formatter)
예제 #5
0
 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)
예제 #6
0
 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)
예제 #7
0
 def test_colorize_always(self):
     # with colorize=Colorize.ALWAYS, return colorizing formatter
     cls = fancylogger._screenLogFormatterFactory(fancylogger.Colorize.ALWAYS)
     self.assertEqual(cls, coloredlogs.ColoredFormatter)
예제 #8
0
 def test_colorize_never(self):
     # with colorize=Colorize.NEVER, return plain old formatter
     cls = fancylogger._screenLogFormatterFactory(fancylogger.Colorize.NEVER)
     self.assertEqual(cls, logging.Formatter)