##// END OF EJS Templates
run-tests: check if stream is a tty before using color...
Matthieu Laneuville -
r33561:2893face default
parent child Browse files
Show More
@@ -101,9 +101,6 b" if os.name != 'nt':"
101 except ImportError:
101 except ImportError:
102 pass
102 pass
103
103
104 if not sys.stderr.isatty(): # check if the terminal is capable
105 with_color = False
106
107 if sys.version_info > (3, 5, 0):
104 if sys.version_info > (3, 5, 0):
108 PYTHON3 = True
105 PYTHON3 = True
109 xrange = range # we use xrange in one place, and we'd rather not use range
106 xrange = range # we use xrange in one place, and we'd rather not use range
@@ -416,13 +413,6 b' def parseargs(args, parser):'
416 parser.error('--chg does not work when --with-hg is specified '
413 parser.error('--chg does not work when --with-hg is specified '
417 '(use --with-chg instead)')
414 '(use --with-chg instead)')
418
415
419 global with_color
420 if options.color != 'auto':
421 if options.color == 'never':
422 with_color = False
423 else: # 'always', for testing purposes
424 with_color = True
425
426 global useipv6
416 global useipv6
427 if options.ipv6:
417 if options.ipv6:
428 useipv6 = checksocketfamily('AF_INET6')
418 useipv6 = checksocketfamily('AF_INET6')
@@ -1574,6 +1564,17 b' class TestResult(unittest._TextTestResul'
1574 self.successes = []
1564 self.successes = []
1575 self.faildata = {}
1565 self.faildata = {}
1576
1566
1567 global with_color
1568 if not self.stream.isatty(): # check if the terminal is capable
1569 with_color = False
1570
1571 if options.color != 'auto':
1572 if options.color == 'never':
1573 with_color = False
1574 else: # 'always', for testing purposes
1575 if pygmentspresent:
1576 with_color = True
1577
1577 def addFailure(self, test, reason):
1578 def addFailure(self, test, reason):
1578 self.failures.append((test, reason))
1579 self.failures.append((test, reason))
1579
1580
General Comments 0
You need to be logged in to leave comments. Login now