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).
This commit is contained in:
parent
323e277482
commit
a7607abcf9
15 changed files with 30 additions and 79 deletions
10
conftest.py
10
conftest.py
|
@ -1,4 +1,4 @@
|
|||
# Copyright (C) 2020-2022 The Software Heritage developers
|
||||
# Copyright (C) 2020-2024 The Software Heritage developers
|
||||
# See the AUTHORS file at the top-level directory of this distribution
|
||||
# License: GNU General Public License version 3, or any later version
|
||||
# See top-level LICENSE file for more information
|
||||
|
@ -13,8 +13,6 @@ os.environ["LC_ALL"] = "C.UTF-8"
|
|||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def tenacity_wait(mocker):
|
||||
# Stops tenacity from blocking lister tests for 50x errors
|
||||
from swh.lister.pattern import Lister
|
||||
|
||||
mocker.patch.object(Lister.http_request.retry, "sleep")
|
||||
def mock_sleep(mocker):
|
||||
# Stops tenacity from blocking lister tests when retrying
|
||||
return mocker.patch("time.sleep")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue