summaryrefslogtreecommitdiffstats
path: root/tests/commands/autoupdate_test.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-04-04 18:42:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-04-04 18:42:11 +0000
commit361ff4da262b4891323287049e9e6c5fbe1d01dc (patch)
tree969b376a2c170841758d39ef9516dac65c8b94cd /tests/commands/autoupdate_test.py
parentAdding upstream version 2.17.0. (diff)
downloadpre-commit-361ff4da262b4891323287049e9e6c5fbe1d01dc.tar.xz
pre-commit-361ff4da262b4891323287049e9e6c5fbe1d01dc.zip
Adding upstream version 2.18.1.upstream/2.18.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/commands/autoupdate_test.py')
-rw-r--r--tests/commands/autoupdate_test.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/commands/autoupdate_test.py b/tests/commands/autoupdate_test.py
index 7316eb9..3806b0e 100644
--- a/tests/commands/autoupdate_test.py
+++ b/tests/commands/autoupdate_test.py
@@ -1,3 +1,5 @@
+from __future__ import annotations
+
import shlex
from unittest import mock
@@ -101,6 +103,24 @@ def test_rev_info_update_tags_only_does_not_pick_tip(tagged):
assert new_info.rev == 'v1.2.3'
+def test_rev_info_update_tags_prefers_version_tag(tagged, out_of_date):
+ cmd_output('git', 'tag', 'latest', cwd=out_of_date.path)
+ config = make_config_from_repo(tagged.path, rev=tagged.original_rev)
+ info = RevInfo.from_config(config)
+ new_info = info.update(tags_only=True, freeze=False)
+ assert new_info.rev == 'v1.2.3'
+
+
+def test_rev_info_update_tags_non_version_tag(out_of_date):
+ cmd_output('git', 'tag', 'latest', cwd=out_of_date.path)
+ config = make_config_from_repo(
+ out_of_date.path, rev=out_of_date.original_rev,
+ )
+ info = RevInfo.from_config(config)
+ new_info = info.update(tags_only=True, freeze=False)
+ assert new_info.rev == 'latest'
+
+
def test_rev_info_update_freeze_tag(tagged):
git_commit(cwd=tagged.path)
config = make_config_from_repo(tagged.path, rev=tagged.original_rev)