From: Zac Medico Date: Tue, 19 Mar 2013 08:35:40 +0000 (-0700) Subject: tests.main(): disable colors when appropriate X-Git-Tag: v2.2.0_alpha167~10 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=478401665d0b1f9613b236f07c6a38e13e2f77e4;p=portage.git tests.main(): disable colors when appropriate --- 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):