Fix bug in RepoTool.repo_fingerprint

Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
Václav Valíček 2022-08-08 09:33:45 +02:00
parent 9b055ef356
commit 94275014c5
Signed by: valicek
GPG Key ID: FF05BDCA0C73BB31
2 changed files with 5 additions and 5 deletions

View File

@ -164,11 +164,11 @@ class Detector:
log.debug(f"Fingerprint file does not exist - run needed") log.debug(f"Fingerprint file does not exist - run needed")
return True return True
old_fingerprint = self._detector_sum.read_text().strip() old_fingerprint = self._detector_sum.read_text().strip()
return not old_fingerprint == self._repo.repo_fingerprint return not old_fingerprint == self._repo.repo_fingerprint()
def persist_fingerprint(self): def persist_fingerprint(self):
log.debug(f"Persisting detector fingerprint") log.debug(f"Persisting detector fingerprint")
self._detector_sum.write_text(str(self._repo.repo_fingerprint)) self._detector_sum.write_text(str(self._repo.repo_fingerprint()))
def run(self, callback: Callable[[DetectedCommit], None]) -> int: def run(self, callback: Callable[[DetectedCommit], None]) -> int:
log.info(f"Running commit detector") log.info(f"Running commit detector")

View File

@ -213,7 +213,7 @@ def test_initialize_caches(tmp_path):
def test_check_fingerprint(tmp_path): def test_check_fingerprint(tmp_path):
mocks = { mocks = {
'repo_fingerprint': PropertyMock(return_value = "FingerPrint"), 'repo_fingerprint': MagicMock(return_value = "FingerPrint"),
} }
repo = tmp_path.joinpath("repo.git") repo = tmp_path.joinpath("repo.git")
@ -236,7 +236,7 @@ def test_check_fingerprint(tmp_path):
def test_persist_fingerprint(tmp_path): def test_persist_fingerprint(tmp_path):
mocks = { mocks = {
'repo_fingerprint': PropertyMock(return_value = "FingerPrint"), 'repo_fingerprint': MagicMock(return_value = "FingerPrint"),
} }
repo = tmp_path.joinpath("repo.git") repo = tmp_path.joinpath("repo.git")
@ -340,7 +340,7 @@ def test_run(tmp_path, caplog):
'list_commits': MagicMock(return_value = commits_named_new), 'list_commits': MagicMock(return_value = commits_named_new),
'list_branches': MagicMock(return_value = branches_new), 'list_branches': MagicMock(return_value = branches_new),
'list_tags': MagicMock(return_value = tags_new), 'list_tags': MagicMock(return_value = tags_new),
'repo_fingerprint': PropertyMock(return_value = "some-fingerprint"), 'repo_fingerprint': MagicMock(return_value = "some-fingerprint"),
} }
repo = tmp_path.joinpath("repo.git") repo = tmp_path.joinpath("repo.git")