10000 ✅ Add cherry-pick success test · python/core-workflow@dda278d · GitHub
[go: up one dir, main page]

Skip to content

Commit dda278d

Browse files
committed
✅ Add cherry-pick success test
1 parent 566775b commit dda278d

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

cherry_picker/cherry_picker/test.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,39 @@ def test_cleanup_branch_fail(tmp_git_repo_dir):
532532
assert get_state() == 'REMOVING_BACKPORT_BRANCH_FAILED'
533533

534534

535+
def test_cherry_pick(
536+
tmp_git_repo_dir, git_add, git_branch, git_commit, git_checkout,
537+
):
538+
cherry_pick_target_branches = '3.8',
539+
pr_remote = 'origin'
540+
test_file = 'some.file'
541+
tmp_git_repo_dir.join(test_file).write('some contents')
542+
git_branch(cherry_pick_target_branches[0])
543+
git_branch(
544+
f'{pr_remote}/{cherry_pick_target_branches[0]}',
545+
cherry_pick_target_branches[0],
546+
)
547+
git_add(test_file)
548+
git_commit('Add a test file')
549+
scm_revision = get_sha1_from('HEAD')
550+
551+
git_checkout( # simulate backport method logic
552+
cherry_pick_target_branches[0],
553+
)
554+
555+
with mock.patch(
556+
'cherry_picker.cherry_picker.validate_sha',
557+
return_value=True,
558+
):
559+
cherry_picker = CherryPicker(
560+
pr_remote,
561+
scm_revision,
562+
cherry_pick_target_branches,
563+
)
564+
565+
cherry_picker.cherry_pick()
566+
567+
535568
def test_cherry_pick_fail(
536569
tmp_git_repo_dir,
537570
):

0 commit comments

Comments
 (0)
0