b6b5e994fae5 (run-tests: check if stream is a tty before using color,
2017-07-18) made the check redundant but forgot to remove it.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
b6b5e994fae5 (run-tests: check if stream is a tty before using color,
2017-07-18) made the check redundant but forgot to remove it.
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | tests/run-tests.py (4 lines) |
Status | Author | Revision | |
---|---|---|---|
Abandoned | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Abandoned | martinvonz | ||
Closed | martinvonz |
if options.color == 'auto': | if options.color == 'auto': | ||||
options.color = with_color | options.color = with_color | ||||
if not sys.stderr.isatty(): # check if the terminal is capable | if not sys.stderr.isatty(): # check if the terminal is capable | ||||
options.color = False | options.color = False | ||||
elif options.color == 'never': | elif options.color == 'never': | ||||
options.color = False | options.color = False | ||||
else: # 'always', for testing purposes | else: # 'always', for testing purposes | ||||
options.color = True | options.color = pygmentspresent | ||||
global useipv6 | global useipv6 | ||||
if options.ipv6: | if options.ipv6: | ||||
useipv6 = checksocketfamily('AF_INET6') | useipv6 = checksocketfamily('AF_INET6') | ||||
else: | else: | ||||
# only use IPv6 if IPv4 is unavailable and IPv6 is available | # only use IPv6 if IPv4 is unavailable and IPv6 is available | ||||
useipv6 = ((not checksocketfamily('AF_INET')) | useipv6 = ((not checksocketfamily('AF_INET')) | ||||
and checksocketfamily('AF_INET6')) | and checksocketfamily('AF_INET6')) | ||||
servefail, lines = getdiff(expected, got, | servefail, lines = getdiff(expected, got, | ||||
test.refpath, test.errpath) | test.refpath, test.errpath) | ||||
if servefail: | if servefail: | ||||
raise test.failureException( | raise test.failureException( | ||||
'server failed to start (HGPORT=%s)' % test._startport) | 'server failed to start (HGPORT=%s)' % test._startport) | ||||
else: | else: | ||||
self.stream.write('\n') | self.stream.write('\n') | ||||
for line in lines: | for line in lines: | ||||
if self._options.color and pygmentspresent: | if self._options.color: | ||||
line = pygments.highlight( | line = pygments.highlight( | ||||
line, | line, | ||||
lexers.DiffLexer(), | lexers.DiffLexer(), | ||||
formatters.Terminal256Formatter()) | formatters.Terminal256Formatter()) | ||||
if PYTHON3: | if PYTHON3: | ||||
self.stream.flush() | self.stream.flush() | ||||
self.stream.buffer.write(line) | self.stream.buffer.write(line) | ||||
self.stream.buffer.flush() | self.stream.buffer.flush() |