[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
98121455e5
commit
fa32525f4c
|
@ -2,4 +2,4 @@ Improved the terminal writer to be able to use Terminal256Formatter and Terminal
|
||||||
|
|
||||||
These are newer versions of TerminalFormmater from the pygments library that is currently in use.
|
These are newer versions of TerminalFormmater from the pygments library that is currently in use.
|
||||||
|
|
||||||
These style of these formatters are set by the users through the environmental variable PYTEST_THEME.
|
These style of these formatters are set by the users through the environmental variable PYTEST_THEME.
|
||||||
|
|
|
@ -219,20 +219,24 @@ class TerminalWriter:
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
# Import new more rich color formatters from the pygments library
|
# Import new more rich color formatters from the pygments library
|
||||||
from pygments.formatters.terminal256 import TerminalTrueColorFormatter
|
|
||||||
from pygments.formatters.terminal256 import Terminal256Formatter
|
from pygments.formatters.terminal256 import Terminal256Formatter
|
||||||
|
from pygments.formatters.terminal256 import TerminalTrueColorFormatter
|
||||||
|
|
||||||
# Use terminal formatters depending on user environment variables
|
# Use terminal formatters depending on user environment variables
|
||||||
if os.environ.get('COLORTERM','') in ('truecolor', '24bit'):
|
if os.environ.get("COLORTERM", "") in ("truecolor", "24bit"):
|
||||||
# Style determined by user set environment variable, if none then use default style
|
# Style determined by user set environment variable, if none then use default style
|
||||||
terminal_formatter = TerminalTrueColorFormatter(style=os.getenv("PYTEST_THEME","default"))
|
terminal_formatter = TerminalTrueColorFormatter(
|
||||||
elif '256' in os.environ.get('TERM', ''):
|
style=os.getenv("PYTEST_THEME", "default")
|
||||||
terminal_formatter = Terminal256Formatter(style=os.getenv("PYTEST_THEME","default"))
|
)
|
||||||
|
elif "256" in os.environ.get("TERM", ""):
|
||||||
|
terminal_formatter = Terminal256Formatter(
|
||||||
|
style=os.getenv("PYTEST_THEME", "default")
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
terminal_formatter = TerminalFormatter(
|
terminal_formatter = TerminalFormatter(
|
||||||
bg=os.getenv("PYTEST_THEME_MODE", "dark"),
|
bg=os.getenv("PYTEST_THEME_MODE", "dark"),
|
||||||
style=os.getenv("PYTEST_THEME"),
|
style=os.getenv("PYTEST_THEME"),
|
||||||
)
|
)
|
||||||
highlighted: str = highlight(
|
highlighted: str = highlight(
|
||||||
source,
|
source,
|
||||||
Lexer(),
|
Lexer(),
|
||||||
|
|
Loading…
Reference in New Issue