Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackenmen committed Aug 7, 2021
1 parent 2cfd2f8 commit bc6bb6f
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions cherry_picker/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ def git_init():
return lambda: subprocess.run(git_init_cmd, check=True)


@pytest.fixture
def git_remote():
git_remote_cmd = "git", "remote"
return lambda *extra_args: (subprocess.run(git_remote_cmd + extra_args, check=True))


@pytest.fixture
def git_add():
git_add_cmd = "git", "add"
Expand Down Expand Up @@ -217,6 +223,27 @@ def test_get_cherry_pick_branch(os_path_exists, config):
assert cp.get_cherry_pick_branch("3.6") == "backport-22a594a-3.6"


@pytest.mark.parametrize("remote_name", ("upstream", "origin", "python"))
def test_upstream_name(remote_name, config, tmp_git_repo_dir, git_remote):
upstream_remote = None
if remote_name == "python":
upstream_remote = "python"
git_remote("add", remote_name, "https://github.com/python/cpython.git")
if remote_name != "origin":
git_remote("add", "origin", "https://github.com/miss-islington/cpython.git")

branches = ["3.6"]
with mock.patch("cherry_picker.cherry_picker.validate_sha", return_value=True):
cp = CherryPicker(
"origin",
"22a594a0047d7706537ff2ac676cdc0f1dcb329c",
branches,
config=config,
upstream_remote=upstream_remote,
)
assert cp.upstream == remote_name


def test_get_pr_url(config):
branches = ["3.6"]

Expand Down

0 comments on commit bc6bb6f

Please sign in to comment.