tests: Ensure the git tag version check does not run for tarball builds

Do not try to determine the latest git tag if we're not in a git
repository in the first place.
This commit is contained in:
Tomas Babej
2021-10-02 18:06:45 -04:00
parent 34c12a7b78
commit c2ba93cb61

View File

@@ -90,13 +90,15 @@ class TestVersion(TestCase):
# corresponding to "compiled from git" or "compiled from tarball" # corresponding to "compiled from git" or "compiled from tarball"
version = out.split() version = out.split()
if 2 >= len(version) > 0: # If we are within a git repository, check the tag version
git = version[1] if os.path.exists("../.git"):
git_expected = "({0})".format(self.slurp_git()) if 2 >= len(version) > 0:
self.assertEqual(git_expected, git) git = version[1]
else: git_expected = "({0})".format(self.slurp_git())
raise ValueError("Unexpected output from _version '{0}'".format( self.assertEqual(git_expected, git)
out)) else:
raise ValueError("Unexpected output from _version '{0}'".format(
out))
ver = version[0] ver = version[0]
ver_expected = self.slurp() ver_expected = self.slurp()