Skip to content

Commit

Permalink
Improve output for missing required plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
The-Compiler committed Jul 29, 2020
1 parent 422685d commit 04f7515
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog/7572.improvement.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
When a plugin listed in `required_plugins` is missing, a simple error message is now shown instead of a stacktrace.
3 changes: 1 addition & 2 deletions src/_pytest/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1174,9 +1174,8 @@ def _validate_plugins(self) -> None:
missing_plugins.append(required_plugin)

if missing_plugins:
fail(
raise UsageError(
"Missing required plugins: {}".format(", ".join(missing_plugins)),
pytrace=False,
)

def _warn_or_fail_if_strict(self, message: str) -> None:
Expand Down
2 changes: 1 addition & 1 deletion testing/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def my_dists():
testdir.makeini(ini_file_text)

if exception_text:
with pytest.raises(pytest.fail.Exception, match=exception_text):
with pytest.raises(pytest.UsageError, match=exception_text):
testdir.parseconfig()
else:
testdir.parseconfig()
Expand Down

0 comments on commit 04f7515

Please sign in to comment.