commit 3f289f0189fb4857cc9ac9b79be61bc3ba5abcb6 from: Antoine Lambert date: Fri Jun 28 16:17:06 2024 UTC tests: Fix mocking of sleep calls with tenacity 8.4.2 Latest tenacity release adds some internal changes that broke the mocking of sleep calls in tests. Fix it by directly mocking time.sleep (was not working previously). commit - 495e2cb4689a1f122c23ea2bf685610e6c2bf58e commit + 3f289f0189fb4857cc9ac9b79be61bc3ba5abcb6 blob - 5bad54e9d7541a7bdf917ba290f64af394a2c4c5 blob + 27ee6f53d7eb3ccb1673950cf2b9e23a6f2381f5 --- requirements-swh.txt +++ requirements-swh.txt @@ -1,5 +1,5 @@ swh.core >= 2.22.0 -swh.loader.core >= 5.18.1 +swh.loader.core >= 5.18.3 swh.model >= 6.13.0 swh.scheduler >= 0.0.39 swh.storage >= 2.4.1 blob - c891a0e6f3366386a361be4016bca2102d04fcc2 blob + 957bb8daae896dc9633b8511cf02bdde7eea4baa --- swh/loader/git/tests/test_loader.py +++ swh/loader/git/tests/test_loader.py @@ -1010,7 +1010,7 @@ class TestDumbGitLoaderWithPack(DumbGitLoaderTestBase) def test_http_get_retry(self, mocker, requests_mock): requests_mock.real_http = True - sleep = mocker.patch.object(dumb.GitObjectsFetcher._http_get.retry, "sleep") + sleep = mocker.patch("time.sleep") nb_files = 0 @@ -1040,7 +1040,7 @@ class TestDumbGitLoaderWithPack(DumbGitLoaderTestBase) assert res == {"status": "eventful"} sleep.assert_has_calls([mocker.call(param) for param in [1] * nb_files]) - sleep = mocker.patch.object(dumb.check_protocol.retry, "sleep") + sleep = mocker.patch("time.sleep") with open(os.path.join(self.bare_repo_path, "info/refs"), "rb") as refs_data: requests_mock.get( f"{self.repo_url}/info/refs",