Regression: Add ANSI colours to highlight test status

This patch adds a very basic pretty-printing of the test status
(passed or failed) to highlight failing tests even more: green for
passed, and red for failed. The printing only uses ANSI it the target
output is a tty and supports ANSI colours. Hence, any regression
scripts that are outputting to files or sending e-mails etc should
still be fine.
This commit is contained in:
Andreas Hansson
2012-04-14 05:44:27 -04:00
parent b6aa6d55eb
commit b9bc530ad2
3 changed files with 36 additions and 9 deletions

View File

@@ -93,6 +93,15 @@ if sys.stdout.isatty():
else:
tty_termcap = no_termcap
def get_termcap(use_colors = None):
if use_colors:
return termcap
elif use_colors is None:
# option unspecified; default behavior is to use colors iff isatty
return tty_termcap
else:
return no_termcap
def test_termcap(obj):
for c_name in color_names:
c_str = getattr(obj, c_name)