def test_custom_match(): with tarball_data('funky_names') as tree: assert find_tag('prefix[0-9]*', git_dir=tree) == 'prefix9.8.7.6'
def find_tag(match: str, strict: bool, directory: str): """Find tag for git repository.""" with suppress(CalledProcessError): echo(git.find_tag(match, strict=strict, git_dir=directory))
def test_non_strict(): with tarball_data('empty') as tree: assert find_tag(strict=None, git_dir=tree) == 'db3ed35e8734'
def test_semver_repo(): with tarball_data('semver') as tree: assert find_tag(git_dir=tree) == 'v2.3.4'
def test_empty_repo(): with tarball_data('empty') as tree, \ raises(CalledProcessError, match='status 128'): find_tag(git_dir=tree)
def test_semver_repo(): with tarball_data('semver') as tree: expect(find_tag(git_dir=tree)) == 'v2.3.4'
def test_empty_repo(): with tarball_data('empty') as tree, expect.raises(CalledProcessError): find_tag(git_dir=tree)