From d9f0a28da2a5225669cd41c7d9bfd040e04b533f Mon Sep 17 00:00:00 2001 From: Christian Theune Date: Wed, 3 Jul 2013 19:43:18 +0200 Subject: [PATCH] Compatibility with my spinal cord reflexes: colorize last summary line. Provide a red bar if there are any 'failures'. Otherwise make it green. --- _pytest/terminal.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/_pytest/terminal.py b/_pytest/terminal.py index 6584179e6..c0ba5cdda 100644 --- a/_pytest/terminal.py +++ b/_pytest/terminal.py @@ -454,10 +454,14 @@ class TerminalReporter: if val: parts.append("%d %s" %(len(val), key)) line = ", ".join(parts) - # XXX coloring msg = "%s in %.2f seconds" %(line, session_duration) if self.verbosity >= 0: - self.write_sep("=", msg, bold=True) + markup = dict(bold=True) + if 'failed' in self.stats: + markup['red'] = True + else: + markup['green'] = True + self.write_sep("=", msg, **markup) #else: # self.write_line(msg, bold=True)