Skip to content

Commit e50e991

Browse files
committed
Fixed redundant tests for SCM
1 parent d6b24f0 commit e50e991

File tree

1 file changed

+1
-25
lines changed

1 file changed

+1
-25
lines changed

tests/test_scm.py

+1-25
Original file line numberDiff line numberDiff line change
@@ -135,37 +135,13 @@ def test_returns_commit_and_tag_info(self, git_repo: Path) -> None:
135135
tag_info = scm.Git.latest_tag_info(tag_name, parse_pattern=parse_pattern)
136136
assert tag_info.commit_sha is not None
137137
assert tag_info.current_version == "0.1.0"
138+
assert tag_info.current_tag == f"{tag_prefix}0.1.0"
138139
assert tag_info.distance_to_latest_tag == 0
139140
assert tag_info.branch_name == "master"
140141
assert tag_info.short_branch_name == "master"
141142
assert tag_info.repository_root == git_repo
142143
assert tag_info.dirty is False
143144

144-
def test_git_latest_tag_info(self, git_repo: Path) -> None:
145-
"""Should return information about the latest tag."""
146-
readme = git_repo.joinpath("readme.md")
147-
readme.touch()
148-
tag_prefix = "app/"
149-
parse_pattern = r"(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)"
150-
tag_name = f"{tag_prefix}{{new_version}}"
151-
with inside_dir(git_repo):
152-
# Add a file and tag
153-
subprocess.run(["git", "add", "readme.md"])
154-
subprocess.run(["git", "commit", "-m", "first"])
155-
subprocess.run(["git", "tag", f"{tag_prefix}0.1.0"])
156-
157-
# Make it dirty
158-
git_repo.joinpath("something.md").touch()
159-
subprocess.run(["git", "add", "something.md"])
160-
tag_info = scm.Git.latest_tag_info(tag_name, parse_pattern=parse_pattern)
161-
assert tag_info.commit_sha is not None
162-
assert tag_info.current_version == "0.1.0"
163-
assert tag_info.distance_to_latest_tag == 0
164-
assert tag_info.branch_name == "master"
165-
assert tag_info.short_branch_name == "master"
166-
assert tag_info.repository_root == git_repo
167-
assert tag_info.dirty is True
168-
169145

170146
def test_git_detects_existing_tag(git_repo: Path, caplog: LogCaptureFixture) -> None:
171147
"""Attempting to tag when a tag exists will do nothing."""

0 commit comments

Comments
 (0)