diff --git a/tangostationcontrol/tangostationcontrol/common/lofar_version.py b/tangostationcontrol/tangostationcontrol/common/lofar_version.py index 92fe0f5faf7f9b5e1f9738b66c67b5123143f531..0d38c9b95231ec69c2fb7ffa7c76003b7e4dcb59 100644 --- a/tangostationcontrol/tangostationcontrol/common/lofar_version.py +++ b/tangostationcontrol/tangostationcontrol/common/lofar_version.py @@ -44,7 +44,7 @@ def get_version(repo: git.Repo = None) -> str: to request the version early enough. The version string is of the following pattern: - - ${MAJOR}.${MINOR}.${PATCH}[.${BRANCH}${COMMIT}][.dirty] + - ${MAJOR}.${MINOR}.${PATCH}[.${BRANCH}$.{COMMIT}][.dirty] For releases only ${MAJOR}.${MINOR}.${PATCH} should be set. Versioning is achieved by tagging commits using the `v${MAJOR}.${MINOR}.${PATCH}` pattern. @@ -88,7 +88,7 @@ def get_version(repo: git.Repo = None) -> str: else: # HEAD of a branch branch = repo.active_branch - commit_str = "{}.{}{}".format(closest_tag.name[1:], branch, commit) + commit_str = "{}.{}.{}".format(closest_tag.name[1:], branch, commit) return "{}{}".format(commit_str, ".dirty" if repo.is_dirty() else "") diff --git a/tangostationcontrol/tangostationcontrol/test/common/test_lofar_git.py b/tangostationcontrol/tangostationcontrol/test/common/test_lofar_version.py similarity index 93% rename from tangostationcontrol/tangostationcontrol/test/common/test_lofar_git.py rename to tangostationcontrol/tangostationcontrol/test/common/test_lofar_version.py index ff51bafbf85968772d15da7e259072ddf09132e4..89ac894d9388d3939671c43239033ce1147fef30 100644 --- a/tangostationcontrol/tangostationcontrol/test/common/test_lofar_git.py +++ b/tangostationcontrol/tangostationcontrol/test/common/test_lofar_version.py @@ -15,10 +15,10 @@ from tangostationcontrol.common import lofar_version from tangostationcontrol.test import base -class TestLofarGit(base.TestCase): +class TestLofarVersion(base.TestCase): def setUp(self): - super(TestLofarGit, self).setUp() + super(TestLofarVersion, self).setUp() # Clear the cache as this function of lofar_version uses LRU decorator # This is a good demonstration of how unit tests in Python can have @@ -43,7 +43,7 @@ class TestLofarGit(base.TestCase): is_dirty=m_is_dirty, head=m_head) # No need for special string equal in Python - self.assertEqual("0.0.0.main123456", lofar_version.get_version()) + self.assertEqual("0.0.0.main.123456", lofar_version.get_version()) def test_get_version_tag(self): """Test if get_version determines production_ready for tagged commit""" @@ -92,7 +92,7 @@ class TestLofarGit(base.TestCase): is_dirty=m_is_dirty, head=m_head) # No need for special string equal in Python - self.assertEqual("0.0.0.main123456.dirty", lofar_version.get_version()) + self.assertEqual("0.0.0.main.123456.dirty", lofar_version.get_version()) def test_catch_repo_error(self): """Test if invalid git directories will raise error"""