[PATCH v3] run-tests: also color the summary messages (skipped, failed...)

Yuya Nishihara yuya at tcha.org
Tue Jul 18 11:36:12 EDT 2017


On Tue, 18 Jul 2017 07:33:50 +0900, mlaneuville at gmail.com wrote:
> # HG changeset patch
> # User Matthieu Laneuville <matthieu.laneuville at octobus.net>
> # Date 1500330427 -32400
> #      Tue Jul 18 07:27:07 2017 +0900
> # Node ID 14c07f0460918fe57b1c2709fe3ea3f071a95659
> # Parent  7f5f97697162331b5acf78aef091ae3fd341e308
> run-tests: also color the summary messages (skipped, failed...)
> 
> diff -r 7f5f97697162 -r 14c07f046091 tests/run-tests.py
> --- a/tests/run-tests.py	Tue Jul 18 07:19:26 2017 +0900
> +++ b/tests/run-tests.py	Tue Jul 18 07:27:07 2017 +0900
> @@ -95,12 +95,46 @@
>      try: # is pygments installed
>          import pygments
>          import pygments.lexers as lexers
> +        import pygments.lexer as lexer
>          import pygments.formatters as formatters
> +        import pygments.token as token
> +        import pygments.style as style
>          with_color = True
>          pygmentspresent = True
>      except ImportError:
>          pass
>  
> +if pygmentspresent:
> +    class TestRunnerStyle(style.Style):
> +        default_style = ""
> +        skipped = token.string_to_tokentype("Token.Generic.Skipped")
> +        failed = token.string_to_tokentype("Token.Generic.Failed")
> +        error = token.string_to_tokentype("Token.Generic.Error")
> +        skippedname = token.string_to_tokentype("Token.Generic.SName")
> +        failedname = token.string_to_tokentype("Token.Generic.FName")
> +        styles = {
> +            skipped:         '#ansilightgray',
> +            skippedname:     '#ansidarkgray',
> +            failed:          '#ansidarkred',
> +            failedname:      '#ansired',
> +        }

Ugh, the buildbot failing.

https://buildbot.mercurial-scm.org/builders/hg%20tests/builds/1100/steps/run-tests.py%20%28python%202.7.10%29/logs/stdio

Does this require newer Pygments?


More information about the Mercurial-devel mailing list