def _find_matching_tag(self, distribution_version): tags = git.tags(self.repo_dir) for version in versions.versions(distribution_version): # tags have a "v" prefix by convention. tag_candidate = "v{}".format(version) if tag_candidate in tags: return tag_candidate return None
def test_list_tags_with_tags_present(self, run_subprocess_with_logging, run_subprocess): run_subprocess_with_logging.return_value = 0 run_subprocess.return_value = [ " v1", " v2", ] assert git.tags("/src") == ["v1", "v2"] run_subprocess.assert_called_with("git -C /src tag")
def test_list_tags_no_tags_available(self, run_subprocess_with_logging, run_subprocess): run_subprocess_with_logging.return_value = 0 run_subprocess.return_value = "" assert git.tags("/src") == [] run_subprocess.assert_called_with("git -C /src tag")