comparison tests/run-tests.py @ 33568:a2c35146596b

run-tests: remove unnecessary 'with_color' variable Its value is always the same as that of 'pygmentspresent'. Differential Revision: https://phab.mercurial-scm.org/D118
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 17 Jul 2017 16:32:10 -0700
parents d9677e2ed16a
children 20436925e080
comparison
equal deleted inserted replaced
33567:d9677e2ed16a 33568:a2c35146596b
86 86
87 origenviron = os.environ.copy() 87 origenviron = os.environ.copy()
88 osenvironb = getattr(os, 'environb', os.environ) 88 osenvironb = getattr(os, 'environb', os.environ)
89 processlock = threading.Lock() 89 processlock = threading.Lock()
90 90
91 with_color = False
92 pygmentspresent = False 91 pygmentspresent = False
93 # ANSI color is unsupported prior to Windows 10 92 # ANSI color is unsupported prior to Windows 10
94 if os.name != 'nt': 93 if os.name != 'nt':
95 try: # is pygments installed 94 try: # is pygments installed
96 import pygments 95 import pygments
97 import pygments.lexers as lexers 96 import pygments.lexers as lexers
98 import pygments.formatters as formatters 97 import pygments.formatters as formatters
99 with_color = True
100 pygmentspresent = True 98 pygmentspresent = True
101 except ImportError: 99 except ImportError:
102 pass 100 pass
103 101
104 if sys.version_info > (3, 5, 0): 102 if sys.version_info > (3, 5, 0):
1567 # Data stored for the benefit of generating xunit reports. 1565 # Data stored for the benefit of generating xunit reports.
1568 self.successes = [] 1566 self.successes = []
1569 self.faildata = {} 1567 self.faildata = {}
1570 1568
1571 if options.color == 'auto': 1569 if options.color == 'auto':
1572 self.color = with_color and self.stream.isatty() 1570 self.color = pygmentspresent and self.stream.isatty()
1573 elif options.color == 'never': 1571 elif options.color == 'never':
1574 self.color = False 1572 self.color = False
1575 else: # 'always', for testing purposes 1573 else: # 'always', for testing purposes
1576 self.color = pygmentspresent 1574 self.color = pygmentspresent
1577 1575