terminalwriter: improve `PYTEST_THEME`, `PYTEST_THEME_MODE` usage errors
This commit is contained in:
parent
67a570aea9
commit
7ef9da1f02
|
@ -235,13 +235,13 @@ class TerminalWriter:
|
|||
|
||||
except pygments.util.ClassNotFound as e:
|
||||
raise UsageError(
|
||||
f"PYTEST_THEME environment variable had an invalid value: '{theme}'. "
|
||||
"Only valid pygment styles are allowed."
|
||||
f"PYTEST_THEME environment variable has an invalid value: '{theme}'. "
|
||||
"Hint: See available pygments styles with `pygmentize -L styles`."
|
||||
) from e
|
||||
except pygments.util.OptionError as e:
|
||||
raise UsageError(
|
||||
f"PYTEST_THEME_MODE environment variable had an invalid value: '{theme_mode}'. "
|
||||
"The only allowed values are 'dark' and 'light'."
|
||||
f"PYTEST_THEME_MODE environment variable has an invalid value: '{theme_mode}'. "
|
||||
"The allowed values are 'dark' (default) and 'light'."
|
||||
) from e
|
||||
|
||||
def _highlight(
|
||||
|
|
|
@ -2609,8 +2609,8 @@ class TestCodeHighlight:
|
|||
monkeypatch.setenv("PYTEST_THEME", "invalid")
|
||||
result = pytester.runpytest_subprocess("--color=yes")
|
||||
result.stderr.fnmatch_lines(
|
||||
"ERROR: PYTEST_THEME environment variable had an invalid value: 'invalid'. "
|
||||
"Only valid pygment styles are allowed."
|
||||
"ERROR: PYTEST_THEME environment variable has an invalid value: 'invalid'. "
|
||||
"Hint: See available pygments styles with `pygmentize -L styles`."
|
||||
)
|
||||
|
||||
def test_code_highlight_invalid_theme_mode(
|
||||
|
@ -2625,8 +2625,8 @@ class TestCodeHighlight:
|
|||
monkeypatch.setenv("PYTEST_THEME_MODE", "invalid")
|
||||
result = pytester.runpytest_subprocess("--color=yes")
|
||||
result.stderr.fnmatch_lines(
|
||||
"ERROR: PYTEST_THEME_MODE environment variable had an invalid value: 'invalid'. "
|
||||
"The only allowed values are 'dark' and 'light'."
|
||||
"ERROR: PYTEST_THEME_MODE environment variable has an invalid value: 'invalid'. "
|
||||
"The allowed values are 'dark' (default) and 'light'."
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue