Skip to content

Commit 819fef8

Browse files
authored
Merge pull request #7765 from nicoddemus/backport-7723
[6.0] Improve output for missing required plugins #7723
2 parents 52363fe + 604047e commit 819fef8

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

changelog/7572.improvement.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
When a plugin listed in ``required_plugins`` is missing, a simple error message is now shown instead of a stacktrace.

src/_pytest/config/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,9 +1174,8 @@ def _validate_plugins(self) -> None:
11741174
missing_plugins.append(required_plugin)
11751175

11761176
if missing_plugins:
1177-
fail(
1177+
raise UsageError(
11781178
"Missing required plugins: {}".format(", ".join(missing_plugins)),
1179-
pytrace=False,
11801179
)
11811180

11821181
def _warn_or_fail_if_strict(self, message: str) -> None:

testing/test_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def my_dists():
362362
testdir.makeini(ini_file_text)
363363

364364
if exception_text:
365-
with pytest.raises(pytest.fail.Exception, match=exception_text):
365+
with pytest.raises(pytest.UsageError, match=exception_text):
366366
testdir.parseconfig()
367367
else:
368368
testdir.parseconfig()

0 commit comments

Comments
 (0)