commit 06aa889eddea7b608fd5d776ff2c1a1cd90d3ab4
Author: Damian Johnson <atagar(a)torproject.org>
Date: Sun Apr 15 18:40:01 2012 -0700
Only coloring test output if it's to a terminal
Dropping the '--no-color' argument in favor of a builtin check for if our
output is going to a tty teminal or not. This is the same trick that git does
for its 'color.ui = true' setting.
---
run_tests.py | 8 +++++---
test/settings.cfg | 1 -
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/run_tests.py b/run_tests.py
index d6a0a52..d764d54 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -44,7 +44,7 @@ import stem.util.log as log
import stem.util.term as term
OPT = "uic:l:t:h"
-OPT_EXPANDED = ["unit", "integ", "config=", "targets=", "log=", "tor=", "no-color", "help"]
+OPT_EXPANDED = ["unit", "integ", "config=", "targets=", "log=", "tor=", "help"]
DIVIDER = "=" * 70
CONFIG = stem.util.conf.config_dict("test", {
@@ -128,6 +128,10 @@ def load_user_configuration(test_config):
print "%s (for usage provide --help)" % exc
sys.exit(1)
+ # suppress color output if our output is being piped
+ if not sys.stdout.isatty():
+ arg_overrides["argument.no_color"] = "true"
+
for opt, arg in opts:
if opt in ("-u", "--unit"):
arg_overrides["argument.unit"] = "true"
@@ -154,8 +158,6 @@ def load_user_configuration(test_config):
arg_overrides["argument.log"] = arg.upper()
elif opt in ("--tor"):
arg_overrides["argument.tor"] = arg
- elif opt in ("--no-color"):
- arg_overrides["argument.no_color"] = "true"
elif opt in ("-h", "--help"):
# Prints usage information and quits. This includes a listing of the
# valid integration targets.
diff --git a/test/settings.cfg b/test/settings.cfg
index b55dc7e..74bb933 100644
--- a/test/settings.cfg
+++ b/test/settings.cfg
@@ -17,7 +17,6 @@ msg.help
| -l, --log RUNLEVEL includes logging output with test results, runlevels:
| TRACE, DEBUG, INFO, NOTICE, WARN, ERROR
| --tor PATH custom tor binary to run testing against
-| --no-color displays testing output without color
| -h, --help presents this help
|
| Integration targets: