Improve output for missing required plugins/unknown config keys (#7723)
Co-authored-by: Florian Bruhin <me@the-compiler.org>
This commit is contained in:
parent
cdf2024070
commit
da21fc5883
|
@ -0,0 +1 @@
|
||||||
|
When a plugin listed in ``required_plugins`` is missing, a simple error message is now shown instead of a stacktrace.
|
|
@ -1246,9 +1246,8 @@ class Config:
|
||||||
missing_plugins.append(required_plugin)
|
missing_plugins.append(required_plugin)
|
||||||
|
|
||||||
if missing_plugins:
|
if missing_plugins:
|
||||||
fail(
|
raise UsageError(
|
||||||
"Missing required plugins: {}".format(", ".join(missing_plugins)),
|
"Missing required plugins: {}".format(", ".join(missing_plugins)),
|
||||||
pytrace=False,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def _warn_or_fail_if_strict(self, message: str) -> None:
|
def _warn_or_fail_if_strict(self, message: str) -> None:
|
||||||
|
|
|
@ -407,7 +407,7 @@ class TestParseIni:
|
||||||
testdir.makeini(ini_file_text)
|
testdir.makeini(ini_file_text)
|
||||||
|
|
||||||
if exception_text:
|
if exception_text:
|
||||||
with pytest.raises(pytest.fail.Exception, match=exception_text):
|
with pytest.raises(pytest.UsageError, match=exception_text):
|
||||||
testdir.parseconfig()
|
testdir.parseconfig()
|
||||||
else:
|
else:
|
||||||
testdir.parseconfig()
|
testdir.parseconfig()
|
||||||
|
|
Loading…
Reference in New Issue