Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dda278d

Browse filesBrowse files
committed
✅ Add cherry-pick success test
1 parent 566775b commit dda278d
Copy full SHA for dda278d

File tree

1 file changed

+33
-0
lines changed
Filter options

1 file changed

+33
-0
lines changed

‎cherry_picker/cherry_picker/test.py

Copy file name to clipboardExpand all lines: cherry_picker/cherry_picker/test.py
+33Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.