Skip to content

Conversation

@nicoddemus
Copy link
Member

@nicoddemus nicoddemus commented Feb 2, 2020

How this looks like in pytest:

image

Copy link
Contributor

@blueyed blueyed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I've thought about adding it to pytest myself.
I think given how thin the wrapper is there is not much gain in adding to pylib - it should rather go into pytest directly AFAICS.
(there's the base for extending it in _pytest._io already.

"""Writes the given source code highlighted"""
if self.hasmarkup:
try:
from pygments.formatters.terminal import TerminalFormatter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also 256-color and true color support.. https://github.com/pygments/pygments/blob/master/pygments/formatters/terminal256.py

Something like this could be used for auto-detect, but it should be made configurable probably.

        pygments_formatter_class = "pygments.formatters.TerminalTrueColorFormatter"
        pygments_formatter_kwargs = {"bg": "light", "style": "solarized-light"}

(from my pdbpp config)

@nicoddemus
Copy link
Member Author

Closing in favor of pytest-dev/pytest#6658

@nicoddemus nicoddemus closed this Feb 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants