예제 #1
0
def test_init_with_uninitialized_dir(temp_empty_dir, empty_vcs_configuration):
    with pytest.raises(re.RepositorySystemError) as exc:
        hr.HgRepo(temp_empty_dir, empty_vcs_configuration)

    assert str(exc.value) == \
        "The current directory {} is not a Hg repository".format(
            temp_empty_dir)
예제 #2
0
def test_pre_start_release_start_from_different_branch(
        temp_hg_dir, empty_vcs_configuration):
    hg_dir = temp_hg_dir
    repo = hr.HgRepo(hg_dir, empty_vcs_configuration)
    hg_repo_add_branch(hg_dir, "other")
    repo.pre_start_release()
    assert repo.get_current_branch() == repo.DEFAULT_BRANCH
예제 #3
0
def test_finish_should_recover_start_branch(
        hg_other_branch, other_branch_vcs_configuration):
    hg_repo_add_branch(hg_other_branch, "third")
    repo = hr.HgRepo(hg_other_branch, other_branch_vcs_configuration)
    repo.pre_start_release()
    repo.start_release()
    repo.finish_release()
    assert repo.get_current_branch() == "third"
예제 #4
0
def test_finish_release_without_changes(
        hg_other_branch, other_branch_vcs_configuration):
    repo = hr.HgRepo(hg_other_branch, other_branch_vcs_configuration)
    repo.pre_start_release()
    repo.start_release()
    repo.finish_release()
    assert repo.get_current_branch() == repo.DEFAULT_BRANCH
    assert 'b' not in repo.get_tags()
예제 #5
0
파일: test_hg_repo.py 프로젝트: jobec/punch
def test_start_summary(temp_hg_dir, empty_vcs_configuration):
    repo = hr.HgRepo(temp_hg_dir, empty_vcs_configuration)
    repo.pre_start_release()
    assert repo.get_summary() == {
        "branch": "default",
        "commit": "(clean)",
        "update": "(current)"
    }
예제 #6
0
def test_pre_start_release_should_use_other_branch(
        temp_hg_dir, other_branch_vcs_configuration):
    hg_dir = temp_hg_dir
    repo = hr.HgRepo(hg_dir, other_branch_vcs_configuration)
    hg_repo_add_branch(hg_dir, "other")
    repo.pre_start_release()
    hg_repo_change_branch(hg_dir, repo.DEFAULT_BRANCH)
    repo.pre_start_release()
    assert repo.get_current_branch() == "other"
예제 #7
0
def test_pre_start_release_in_unclean_state(
        temp_hg_dir, empty_vcs_configuration):
    hg_dir = temp_hg_dir
    with open(os.path.join(hg_dir, "README.md"), "w") as f:
        f.writelines(["Uncommitted lines"])
    repo = hr.HgRepo(hg_dir, empty_vcs_configuration)
    with pytest.raises(re.RepositoryStatusError):
        repo.pre_start_release()

    assert repo.get_current_branch() == repo.DEFAULT_BRANCH
예제 #8
0
def test_finish_release_custom_tag_cannot_be_a_number(temp_hg_dir):
    release_name = "1.0"
    commit_message = "A commit message"
    tag = "12234"

    config = vc.VCSConfiguration('hg', {'tag': tag}, global_variables={},
                                 special_variables={
                                     'new_version': release_name},
                                 commit_message=commit_message)

    with pytest.raises(re.RepositoryConfigurationError):
        hr.HgRepo(temp_hg_dir, config)
예제 #9
0
def ready_to_finish_repo(temp_hg_dir, **kwargs):
    release_name = "1.0"
    commit_message = "A commit message"
    config = vc.VCSConfiguration(
        'git', kwargs, global_variables={},
        special_variables={'new_version': release_name},
        commit_message=commit_message
    )

    repo = hr.HgRepo(temp_hg_dir, config)
    repo.pre_start_release()
    repo.start_release()

    hg_repo_add_file(temp_hg_dir, "version.txt", release_name + "\n")

    return repo
예제 #10
0
def test_start_release_should_be_in_defined_branch(
        hg_other_branch, other_branch_vcs_configuration):
    repo = hr.HgRepo(hg_other_branch, other_branch_vcs_configuration)
    repo.pre_start_release()
    repo.start_release()
    assert repo.get_current_branch() == "other"
예제 #11
0
def test_pre_start_release(temp_hg_dir, empty_vcs_configuration):
    repo = hr.HgRepo(temp_hg_dir, empty_vcs_configuration)
    repo.pre_start_release()

    assert repo.get_current_branch() == repo.DEFAULT_BRANCH
예제 #12
0
def test_get_tags(temp_hg_dir, empty_vcs_configuration):
    repo = hr.HgRepo(temp_hg_dir, empty_vcs_configuration)
    assert repo.get_tags() == 'tip'
예제 #13
0
def test_get_current_branch(temp_hg_dir, empty_vcs_configuration):
    repo = hr.HgRepo(temp_hg_dir, empty_vcs_configuration)
    assert repo.get_current_branch() == repo.DEFAULT_BRANCH
예제 #14
0
def test_init(temp_empty_hg_dir, empty_vcs_configuration):
    repo = hr.HgRepo(temp_empty_hg_dir, empty_vcs_configuration)
    assert repo.working_path == temp_empty_hg_dir
예제 #15
0
def test_get_branches(hg_other_branch, empty_vcs_configuration):
    repo = hr.HgRepo(hg_other_branch, empty_vcs_configuration)
    assert {"default", "other"} == repo.get_branches()
예제 #16
0
def test_tag(temp_hg_dir, empty_vcs_configuration):
    repo = hr.HgRepo(temp_hg_dir, empty_vcs_configuration)

    repo.tag("just_a_tag")

    assert "just_a_tag" in repo.get_tags()
예제 #17
0
파일: test_hg_repo.py 프로젝트: h4/punch
def test_get_info(temp_hg_dir, empty_vcs_configuration):
    repo = hr.HgRepo(temp_hg_dir, empty_vcs_configuration)

    assert repo.get_info() == [
        ("Commit message", "Version updated a -> b"),
    ]