From 478401665d0b1f9613b236f07c6a38e13e2f77e4 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 19 Mar 2013 01:35:40 -0700 Subject: [PATCH] tests.main(): disable colors when appropriate --- pym/portage/tests/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pym/portage/tests/__init__.py b/pym/portage/tests/__init__.py index ee1e5639c..a46c2db42 100644 --- a/pym/portage/tests/__init__.py +++ b/pym/portage/tests/__init__.py @@ -14,6 +14,7 @@ try: except ImportError: from unittest import _TextTestResult +import portage from portage import os from portage import _encodings from portage import _unicode_decode @@ -28,6 +29,11 @@ def main(): action="store_true", dest="list_tests") (options, args) = parser.parse_args(args=sys.argv) + if (os.environ.get('NOCOLOR') in ('yes', 'true') or + os.environ.get('TERM') == 'dumb' or + not sys.stdout.isatty()): + portage.output.nocolor() + if options.list_tests: testdir = os.path.dirname(sys.argv[0]) for mydir in getTestDirs(basedir): -- 2.26.2