diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -1564,16 +1564,14 @@ self.successes = [] self.faildata = {} - global with_color if not self.stream.isatty(): # check if the terminal is capable - with_color = False - - if options.color != 'auto': - if options.color == 'never': - with_color = False - else: # 'always', for testing purposes - if pygmentspresent: - with_color = True + options.color = False + elif options.color == 'auto': + options.color = with_color + elif options.color == 'never': + options.color = False + else: # 'always', for testing purposes + options.color = pygmentspresent def addFailure(self, test, reason): self.failures.append((test, reason)) @@ -1652,7 +1650,7 @@ else: self.stream.write('\n') for line in lines: - if with_color and pygmentspresent: + if self._options.color and pygmentspresent: line = pygments.highlight( line, lexers.DiffLexer(),