##// END OF EJS Templates
run-tests: make sure to check if pygments is installed before using it...
Pulkit Goyal -
r33552:754569f5 default
parent child Browse files
Show More
@@ -89,7 +89,7 b" osenvironb = getattr(os, 'environb', os."
89 processlock = threading.Lock()
89 processlock = threading.Lock()
90
90
91 with_color = False
91 with_color = False
92
92 pygmentspresent = False
93 # ANSI color is unsupported prior to Windows 10
93 # ANSI color is unsupported prior to Windows 10
94 if os.name != 'nt':
94 if os.name != 'nt':
95 try: # is pygments installed
95 try: # is pygments installed
@@ -97,6 +97,7 b" if os.name != 'nt':"
97 import pygments.lexers as lexers
97 import pygments.lexers as lexers
98 import pygments.formatters as formatters
98 import pygments.formatters as formatters
99 with_color = True
99 with_color = True
100 pygmentspresent = True
100 except ImportError:
101 except ImportError:
101 pass
102 pass
102
103
@@ -1650,7 +1651,7 b' class TestResult(unittest._TextTestResul'
1650 else:
1651 else:
1651 self.stream.write('\n')
1652 self.stream.write('\n')
1652 for line in lines:
1653 for line in lines:
1653 if with_color:
1654 if with_color and pygmentspresent:
1654 line = pygments.highlight(
1655 line = pygments.highlight(
1655 line,
1656 line,
1656 lexers.DiffLexer(),
1657 lexers.DiffLexer(),
@@ -121,7 +121,7 b' test churn with globs'
121
121
122 test diff colorisation
122 test diff colorisation
123
123
124 #if no-windows
124 #if no-windows pygments
125 $ rt test-failure.t --color always
125 $ rt test-failure.t --color always
126
126
127 \x1b[38;5;124m--- $TESTTMP/test-failure.t\x1b[39m (esc)
127 \x1b[38;5;124m--- $TESTTMP/test-failure.t\x1b[39m (esc)
General Comments 0
You need to be logged in to leave comments. Login now