Warn when cmdline_main raises SystemExit - #14923
Conversation
for more information, see https://pre-commit.ci
|
@RonnyPfannschmidt sorry about the previous pr it was my mistake could you please take a look at this one when you available? thanks |
|
I'm closing this, and I'm blocking you from the repository for one month. The reasons are at the bottom. The technical findings come first, because they are the evidence: I had to build a plugin, run it, patch two alternative implementations and run those too, in order to establish that this PR does not do what its description claims. That is the work you handed me. Everything below was reproduced locally against The warning does not identify the pluginThe PR description says the problem is that pytest terminates "without identifying the plugin as the source". This is what a user actually sees: "A plugin". No name, no file, no line — and the location shown is pytest's own source. The user is exactly as far from finding the culprit as before, they just get an extra two lines of noise on the way out. Compare with what pytest already does when a plugin raises So the new branch is strictly less diagnostic than what pytest already does for the sibling case, for the one hook that wasn't covered. The plugin name is cheap to recover — walk the traceback to the deepest frame and ask the plugin manager. I prototyped it, ~8 lines, and it prints: That is the message worth having. Anything less doesn't close #8986.
|
Summary
Warn when a plugin raises
SystemExitfrom thepytest_cmdline_mainhook.Previously, this could terminate pytest during command-line startup without identifying the plugin as the source. This change emits a
PytestConfigWarningwhile preserving the originalSystemExitbehavior and exit code.Closes #8986
Testing
python -m pytest testing/test_config.py -qpython -m pytest testing/test_config.py testing/test_runner.py -qResult:
348 passed, 2 xfailedChecklist
Closes #8986to the PR description.Co-authored-bycommit trailers.changelogdirectory.AUTHORSin alphabetical order.