Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)