def test_get_tag_no_git_repo(self): """ Try to get tag out of a git repo """ git = Git(folder=temp_folder()) with six.assertRaisesRegex(self, ConanException, "Not a valid 'git' repository"): git.get_tag()
def test_get_tag_no_git_repo(self): # Try to get tag out of a git repo tmp_folder = temp_folder() git = Git(folder=tmp_folder) pattern = "'{0}' is not a valid 'git' repository or 'git' not found".format( re.escape(tmp_folder)) with six.assertRaisesRegex(self, ConanException, pattern): git.get_tag()
def test_no_tag(self): """ No tags has been created in repo """ git = Git(folder=self.folder) tag = git.get_tag() self.assertIsNone(tag)
def test_in_tag(self): """ Current checkout is on a tag """ git = Git(folder=self.folder) git.run("tag 0.0.0") tag = git.get_tag() self.assertEqual("0.0.0", tag)
def test_in_branch_with_tag(self): """ Tag is defined but current commit is ahead of it """ git = Git(folder=self.folder) git.run("tag 0.0.0") save(os.path.join(self.folder, "file.txt"), "") git.run("add .") git.run("commit -m \"new file\"") tag = git.get_tag() self.assertIsNone(tag)