Repository navigation
#378 Get a nice error message when running diff-quality with a tool which is not installed - #380
Merged
Merged
Conversation
d-perl
force-pushed
the
378_fix_error_message
branch
from
December 13, 2023 15:23
a0b744a to
59fed0c
Compare
Black is upset, looks like the change is simple enough
Owner
|
ok, quick glance looks like some tests broke. My guess is its some mocking that broke. Let me know if you need some help looking a bit deeper |
Owner
|
Also, hope you dont mind my commit, I just wanted to get past the formatting step |
Contributor
Author
|
Oh, my bad. It was because |
Owner
|
Alright, lets get this out. Thanks for the PR! |
Bachmann1234
pushed a commit
that referenced
this pull request
Aug 16, 2026
…620) * fix: report a missing git instead of an unhandled FileNotFoundError (#303) subprocess.Popen sits outside the try in command_runner.execute, so when the executable itself is missing the FileNotFoundError escapes raw. Both entry points call GitPathTool.set_cwd before their own error handling begins -- diff_quality_tool.main already has `except OSError -> LOGGER.error -> return 1` further down, it simply never gets the chance to run -- so `diff-cover` and `diff-quality` print a traceback when git is not installed. Add ExecutableNotFoundError as a subclass of CommandError, so anything that already catches CommandError keeps working, and raise it from execute() only for the FileNotFoundError that Popen throws. A command that runs and then fails is untouched: tests/test_integration.py requires CommandError to escape main() in that case, and it still does. Both main() functions now wrap set_cwd and report the message through LOGGER.error, returning 1. This is the same class of fix as #380 for #378, which covered the "the linter is not installed" path through run_command_for_code; the "git is not installed" path through execute was left as it was. * test: assert on the install URL without a substring check CodeQL flagged `assert "https://git-scm.com/" in message` as py/incomplete-url-substring-sanitization. The rule is about URL checks done with substring containment, and a test assertion is written the same way as the pattern it warns about. Import GIT_INSTALL_URL and assert on the whole trailing sentence instead, which is a stricter assertion anyway, and use the constant for the negative case as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #378
To test, compare with "steps to reproduce" in the linked issue