Skip to content

Commit 4b63d05

Browse files
committed
✅ Add cherry-pick fail test
1 parent d5a9564 commit 4b63d05

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

cherry_picker/cherry_picker/test.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from .cherry_picker import get_base_branch, get_current_branch, \
1010
get_full_sha_from_short, get_author_info_from_short_sha, \
11-
CherryPicker, InvalidRepoException, \
11+
CherryPicker, InvalidRepoException, CherryPickException, \
1212
normalize_commit_message, DEFAULT_CONFIG, \
1313
get_sha1_from, find_config, load_config, validate_sha, \
1414
from_git_rev_read, \
@@ -530,3 +530,16 @@ def test_cleanup_branch_fail(tmp_git_repo_dir):
530530

531531
cherry_picker.cleanup_branch('some_branch')
532532
assert get_state() == 'REMOVING_BACKPORT_BRANCH_FAILED'
533+
534+
535+
def test_cherry_pick_fail(
536+
tmp_git_repo_dir,
537+
):
538+
with mock.patch(
539+
'cherry_picker.cherry_picker.validate_sha',
540+
return_value=True,
541+
):
542+
cherry_picker = CherryPicker('origin', 'xxx', [])
543+
544+
with pytest.raises(CherryPickException, message='Error cherry-pick xxx.'):
545+
cherry_picker.cherry_pick()

0 commit comments

Comments
 (0)