From 94275014c57585a3f05f227d123bff7936fbd9be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Val=C3=AD=C4=8Dek?= Date: Mon, 8 Aug 2022 09:33:45 +0200 Subject: [PATCH] Fix bug in RepoTool.repo_fingerprint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Václav Valíček --- repo_cloner/lib/detector.py | 4 ++-- tests/lib/test_detector.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/repo_cloner/lib/detector.py b/repo_cloner/lib/detector.py index 912d259..034329e 100644 --- a/repo_cloner/lib/detector.py +++ b/repo_cloner/lib/detector.py @@ -164,11 +164,11 @@ class Detector: log.debug(f"Fingerprint file does not exist - run needed") return True 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): 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: log.info(f"Running commit detector") diff --git a/tests/lib/test_detector.py b/tests/lib/test_detector.py index bc7a6b2..450048e 100644 --- a/tests/lib/test_detector.py +++ b/tests/lib/test_detector.py @@ -213,7 +213,7 @@ def test_initialize_caches(tmp_path): def test_check_fingerprint(tmp_path): mocks = { - 'repo_fingerprint': PropertyMock(return_value = "FingerPrint"), + 'repo_fingerprint': MagicMock(return_value = "FingerPrint"), } repo = tmp_path.joinpath("repo.git") @@ -236,7 +236,7 @@ def test_check_fingerprint(tmp_path): def test_persist_fingerprint(tmp_path): mocks = { - 'repo_fingerprint': PropertyMock(return_value = "FingerPrint"), + 'repo_fingerprint': MagicMock(return_value = "FingerPrint"), } 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_branches': MagicMock(return_value = branches_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")