From afa88a479bbf9460dd46394427a4d27302d28caf Mon Sep 17 00:00:00 2001 From: Andreas Pelme Date: Mon, 5 Aug 2013 09:45:10 +0200 Subject: [PATCH] Added color to the quite mode summary. Also changed the output format slightly to match the output of the standard summary. --HG-- branch : quiet-color-summary --- _pytest/terminal.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/_pytest/terminal.py b/_pytest/terminal.py index 5a1e877ec..2fbe9c6b3 100644 --- a/_pytest/terminal.py +++ b/_pytest/terminal.py @@ -455,19 +455,17 @@ class TerminalReporter: parts.append("%d %s" % (len(val), key)) line = ", ".join(parts) msg = "%s in %.2f seconds" % (line, session_duration) + + markup = {'bold': True} + if 'failed' in self.stats or 'error' in self.stats: + markup = {'red': True, 'bold': True} + else: + markup = {'green': True, 'bold': True} + if self.verbosity >= 0: - markup = dict(bold=True) - if 'failed' in self.stats or 'error' in self.stats: - markup['red'] = True - else: - markup['green'] = True self.write_sep("=", msg, **markup) if self.verbosity == -1: - if line: - self.write("%s, " % line) - self.write("time: %.2f seconds\n" % session_duration) - #else: - # self.write_line(msg, bold=True) + self.write_line(msg, **markup) def summary_deselected(self): if 'deselected' in self.stats: