D115: run-tests: move check isatty() check for color inside parseargs()
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Tue Jul 18 00:06:11 UTC 2017
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
This will help with removing the global variables by making sure
'pygmentspresent' always has the same value as 'with_color'.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D115
AFFECTED FILES
tests/run-tests.py
CHANGE DETAILS
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -101,9 +101,6 @@
except ImportError:
pass
-if not sys.stderr.isatty(): # check if the terminal is capable
- with_color = False
-
if sys.version_info > (3, 5, 0):
PYTHON3 = True
xrange = range # we use xrange in one place, and we'd rather not use range
@@ -418,6 +415,8 @@
if options.color == 'auto':
options.color = with_color
+ if not sys.stderr.isatty(): # check if the terminal is capable
+ options.color = False
elif options.color == 'never':
options.color = False
else: # 'always', for testing purposes
EMAIL PREFERENCES
https://phab.mercurial-scm.org/settings/panel/emailpreferences/
To: martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list