def test_rev_info_update_freeze_tag(tagged): git_commit(cwd=tagged.path) config = make_config_from_repo(tagged.path, rev=tagged.original_rev) info = RevInfo.from_config(config) new_info = info.update(tags_only=True, freeze=True) assert new_info.rev == tagged.head_rev assert new_info.frozen == 'v1.2.3'
def test_rev_info_update_out_of_date_repo(out_of_date): config = make_config_from_repo( out_of_date.path, rev=out_of_date.original_rev, ) info = RevInfo.from_config(config) new_info = info.update(tags_only=False, freeze=False) assert new_info.rev == out_of_date.head_rev
def test_rev_info_update_does_not_freeze_if_already_sha(out_of_date): config = make_config_from_repo( out_of_date.path, rev=out_of_date.original_rev, ) info = RevInfo.from_config(config) new_info = info.update(tags_only=True, freeze=True) assert new_info.rev == out_of_date.head_rev assert new_info.frozen is None
def test_rev_info_update_tags_non_version_tag(out_of_date): cmd_output('git', 'tag', 'latest', cwd=out_of_date.path) config = make_config_from_repo( out_of_date.path, rev=out_of_date.original_rev, ) info = RevInfo.from_config(config) new_info = info.update(tags_only=True, freeze=False) assert new_info.rev == 'latest'
def test_hook_disppearing_repo_raises(hook_disappearing, store): config = make_config_from_repo( hook_disappearing.path, rev=hook_disappearing.original_rev, hooks=[{'id': 'foo'}], ) info = RevInfo.from_config(config).update(tags_only=False, freeze=False) with pytest.raises(RepositoryCannotBeUpdatedError): _check_hooks_still_exist_at_rev(config, info, store)
def test_rev_info_update_tags_only_does_not_pick_tip(tagged): git_commit(cwd=tagged.path) config = make_config_from_repo(tagged.path, rev=tagged.original_rev) info = RevInfo.from_config(config) new_info = info.update(tags_only=True, freeze=False) assert new_info.rev == 'v1.2.3'
def test_rev_info_update_tags_even_if_not_tags_only(tagged): config = make_config_from_repo(tagged.path, rev=tagged.original_rev) info = RevInfo.from_config(config) new_info = info.update(tags_only=False, freeze=False) assert new_info.rev == 'v1.2.3'
def test_rev_info_update_up_to_date_repo(up_to_date): config = make_config_from_repo(up_to_date) info = RevInfo.from_config(config) new_info = info.update(tags_only=False, freeze=False) assert info == new_info
def test_rev_info_from_config(): info = RevInfo.from_config({'repo': 'repo/path', 'rev': 'v1.2.3'}) assert info == RevInfo('repo/path', 'v1.2.3', None)