Patchwork D136: run-tests: combine color conditions into one

login
register
mail settings
Submitter phabricator
Date July 18, 2017, 4:13 p.m.
Message ID <differential-rev-PHID-DREV-pfshndamwx26usogew2z-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/22497/
State Superseded, archived
Headers show

Comments

phabricator - July 18, 2017, 4:13 p.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D136

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS




EMAIL PREFERENCES
  https://phab.mercurial-scm.org/settings/panel/emailpreferences/

To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1566,14 +1566,8 @@ 
         self.successes = []
         self.faildata = {}
 
-        if not self.stream.isatty(): # check if the terminal is capable
-            options.color = False
-        elif options.color == 'auto':
-            options.color = pygmentspresent
-        elif options.color == 'never':
-            options.color = False
-        else: # 'always', for testing purposes
-            options.color = pygmentspresent
+        options.color = (pygmentspresent and self.stream.isatty() and
+                         options.color != 'never')
 
     def addFailure(self, test, reason):
         self.failures.append((test, reason))