コード例 #1
0
 def testTermcolorTrue(self):
     """
     termcolor=True results in terminal output
     """
     c = Colors(termcolor=True)
     self.assertTrue(c.termcolor)
     self.assertTrue(len(c.bold("")) > 0)
コード例 #2
0
 def testTermcolorFalse(self):
     """
     termcolor=False results in no terminal output
     """
     c = Colors(termcolor=False)
     self.assertFalse(c.termcolor)
     self.assertFalse(len(c.bold("")) > 0)
コード例 #3
0
 def testUp(self):
     """
     calling up gives us a non-blank string
     """
     c = Colors()
     up = c.up()
     self.assertEqual(type(up), str)
     self.assertNotEqual(up, '')
コード例 #4
0
 def testDisableWindowsTrue(self):
     """
     disable_windows=True: ANSI color codes are present in the stream
     """
     c = Colors(termcolor=True)
     s = StringIO()
     gs = GreenStream(s, disable_windows=True)
     msg = c.red("some colored string")
     gs.write(msg)
     self.assertEqual(len(gs.stream.getvalue()), len(msg))
コード例 #5
0
ファイル: test_result.py プロジェクト: MatsLanGoH/green
 def test_displayStderr(self):
     """
     displayStderr displays captured stderr
     """
     stream = StringIO()
     noise = "blah blah blah"
     btr = BaseTestResult(stream, Colors(False))
     pt = ProtoTest()
     btr.stderr_errput[pt] = noise
     btr.displayStderr(pt)
     self.assertIn(noise, stream.getvalue())
コード例 #6
0
 def testTermstyleColorsDoNotCrash(self):
     """
     termstyle-based colors don't crash and output something
     """
     c = Colors(termcolor=True)
     for func in [c.bold, c.blue, c.green, c.red, c.yellow, c.passing,
             c.failing, c.error, c.skipped, c.unexpectedSuccess,
             c.expectedFailure, c.moduleName]:
         self.assertTrue(len(func("")) > 0)
     # c.className is a special case
     c.className("")
コード例 #7
0
 def testDisableWindowsFalse(self):
     """
     disable_windows=False: Colorama strips ANSI color codes from the stream
     """
     c = Colors(termcolor=True)
     s = StringIO()
     gs = GreenStream(s, override_appveyor=True, disable_windows=False)
     colored_msg = c.red("a")
     gs.write(colored_msg)
     import colorama
     self.assertTrue(
         issubclass(type(gs.stream), colorama.ansitowin32.StreamWrapper))
コード例 #8
0
ファイル: result.py プロジェクト: janusnic/green
 def __init__(self, args, stream):
     super(GreenTestResult, self).__init__(stream, Colors(args.termcolor))
     self.args = args
     self.showAll       = args.verbose > 1
     self.dots          = args.verbose == 1
     self.verbose       = args.verbose
     self.last_module   = ''
     self.last_class    = ''
     self.failfast      = args.failfast
     self.shouldStop    = False
     self.testsRun      = 0
     # Individual lists
     self.errors              = []
     self.expectedFailures    = []
     self.failures            = []
     self.passing             = []
     self.skipped             = []
     self.unexpectedSuccesses = []
     # Combination of all errors and failures
     self.all_errors = []
コード例 #9
0
 def __init__(self, args, stream):
     super(GreenTestResult, self).__init__(stream, Colors(args.termcolor))
     self.args = args
     self.showAll = args.verbose > 1
     self.dots = args.verbose == 1
     self.verbose = args.verbose
     self.last_module = ""
     self.last_class = ""
     self.first_text_output = ""
     self.failfast = args.failfast
     self.shouldStop = False
     self.testsRun = 0
     # Individual lists
     self.errors = []
     self.expectedFailures = []
     self.failures = []
     self.passing = []
     self.skipped = []
     self.unexpectedSuccesses = []
     # Combination of all errors and failures
     self.all_errors = []
     # For exiting non-zero if we don't reach a certain level of coverage
     self.coverage_percent = None
コード例 #10
0
 def testTermcolorAuto(self):
     """
     termcolor=None causes termcolor autodetected and set to True or False
     """
     c = Colors()
     self.assertTrue(c.termcolor in [True, False])