def test_get_latest_tag_name(tmp_commitizen_project): with tmp_commitizen_project.as_cwd(): tag_name = git.get_latest_tag_name() assert tag_name is None create_file_and_commit("feat(test): test") cmd.run("git tag 1.0") tag_name = git.get_latest_tag_name() assert tag_name == "1.0"
def _ask_tag(self) -> str: latest_tag = get_latest_tag_name() if not latest_tag: out.error("No Existing Tag. Set tag to v0.0.1") return "0.0.1" is_correct_tag = questionary.confirm( f"Is {latest_tag} the latest tag?", style=self.cz.style, default=False).ask() if not is_correct_tag: tags = get_tag_names() if not tags: out.error("No Existing Tag. Set tag to v0.0.1") return "0.0.1" latest_tag = questionary.select( "Please choose the latest tag: ", choices=get_tag_names(), style=self.cz.style, ).ask() if not latest_tag: out.error("Tag is required!") raise SystemExit() return latest_tag