Mercurial > hg
comparison tests/run-tests.py @ 33866:4e8a46c25fac
run-tests: pre instantiate pygments objects
Pre instantiate pygments objects to minimize overhead (cf. 20436925e080)
author | Matthieu Laneuville <matthieu.laneuville@octobus.net> |
---|---|
date | Tue, 22 Aug 2017 11:00:00 +0200 |
parents | 81b12f69ef5b |
children | 5f3845b4ca15 |
comparison
equal
deleted
inserted
replaced
33865:af20468eb0a4 | 33866:4e8a46c25fac |
---|---|
133 'failed': [ | 133 'failed': [ |
134 (r'[\w-]+\.t', token.Generic.FName), | 134 (r'[\w-]+\.t', token.Generic.FName), |
135 (r'(:| ).*', token.Generic.Failed), | 135 (r'(:| ).*', token.Generic.Failed), |
136 ] | 136 ] |
137 } | 137 } |
138 | |
139 runnerformatter = formatters.Terminal256Formatter(style=TestRunnerStyle) | |
140 runnerlexer = TestRunnerLexer() | |
138 | 141 |
139 if sys.version_info > (3, 5, 0): | 142 if sys.version_info > (3, 5, 0): |
140 PYTHON3 = True | 143 PYTHON3 = True |
141 xrange = range # we use xrange in one place, and we'd rather not use range | 144 xrange = range # we use xrange in one place, and we'd rather not use range |
142 def _bytespath(p): | 145 def _bytespath(p): |
1635 if not self._options.nodiff: | 1638 if not self._options.nodiff: |
1636 formatted = '\nERROR: %s output changed\n' % test | 1639 formatted = '\nERROR: %s output changed\n' % test |
1637 if self.color: | 1640 if self.color: |
1638 formatted = pygments.highlight( | 1641 formatted = pygments.highlight( |
1639 formatted, | 1642 formatted, |
1640 TestRunnerLexer(), | 1643 runnerlexer, |
1641 formatters.Terminal256Formatter( | 1644 runnerformatter) |
1642 style=TestRunnerStyle)) | |
1643 self.stream.write(formatted) | 1645 self.stream.write(formatted) |
1644 self.stream.write('!') | 1646 self.stream.write('!') |
1645 | 1647 |
1646 self.stream.flush() | 1648 self.stream.flush() |
1647 | 1649 |
2044 for test, msg in result.skipped: | 2046 for test, msg in result.skipped: |
2045 formatted = 'Skipped %s: %s' % (test.name, msg) | 2047 formatted = 'Skipped %s: %s' % (test.name, msg) |
2046 if result.color: | 2048 if result.color: |
2047 formatted = pygments.highlight( | 2049 formatted = pygments.highlight( |
2048 formatted, | 2050 formatted, |
2049 TestRunnerLexer(), | 2051 runnerlexer, |
2050 formatters.Terminal256Formatter( | 2052 runnerformatter).strip("\n") |
2051 style=TestRunnerStyle)).strip("\n") | |
2052 self.stream.writeln(formatted) | 2053 self.stream.writeln(formatted) |
2053 for test, msg in result.failures: | 2054 for test, msg in result.failures: |
2054 formatted = 'Failed %s: %s' % (test.name, msg) | 2055 formatted = 'Failed %s: %s' % (test.name, msg) |
2055 if result.color: | 2056 if result.color: |
2056 formatted = pygments.highlight( | 2057 formatted = pygments.highlight( |
2057 formatted, | 2058 formatted, |
2058 TestRunnerLexer(), | 2059 runnerlexer, |
2059 formatters.Terminal256Formatter( | 2060 runnerformatter).strip("\n") |
2060 style=TestRunnerStyle)).strip("\n") | |
2061 self.stream.writeln(formatted) | 2061 self.stream.writeln(formatted) |
2062 for test, msg in result.errors: | 2062 for test, msg in result.errors: |
2063 self.stream.writeln('Errored %s: %s' % (test.name, msg)) | 2063 self.stream.writeln('Errored %s: %s' % (test.name, msg)) |
2064 | 2064 |
2065 if self._runner.options.xunit: | 2065 if self._runner.options.xunit: |