Conversation
ezio-melotti
left a comment
There was a problem hiding this comment.
A few questions/comments:
- How does the output look like after this changes?
- Since this
exceptseems higher up in the call stack, can it be triggered by other failures that are not related to sha validation? - IIRC the goal of the sha validation is to find out if the given commit exists in the repo, so instead of saying
"Error validate sha", I would say something likef"Cannot locate sha commit. Are you inside a {config['repo']} repo?"(this is assuming this error is triggered only by failed sha validation, if not it should be moved deeper in the function that checks) - Can you add a test for this?
|
Hi @ezio-melotti, thanks for reviewing my PR. For your questions,
4 . Yes, the test would be like this (tested): def test_cli_invoked_invalid_repo():
with pytest.raises(subprocess.CalledProcessError) as exc_info:
subprocess.check_output("cherry_picker")
assert exc_info.value.output.decode().startswith(
"\U0001F40D \U0001F352 \u26CF\nCannot locate sha commit or get state. Are you inside a cpython repo?"
) |
|
Regarding the error message: it looks like the original error message (at least for the invalid sha) is clear enough, so perhaps there is no need to add the Regarding the test, there is actually a test already, but only checks the exception type: cherry-picker/cherry_picker/test_cherry_picker.py Lines 407 to 410 in d7c3264 You can use |
I think the original error message is clear too: cherry-picker/cherry_picker/cherry_picker.py Lines 675 to 686 in d7c3264 If we both agree there is no need to add the summary of error message, I can just enhance existing tests. |
This reverts commit c67105a.
Fixes #99
Re: #99 (comment)