swh-lister/conftest.py
Antoine Lambert a7607abcf9 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).
2024-06-28 18:15:36 +02:00

18 lines
550 B
Python

# 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
import os
import pytest
pytest_plugins = ["swh.scheduler.pytest_plugin", "swh.core.github.pytest_plugin"]
os.environ["LC_ALL"] = "C.UTF-8"
@pytest.fixture(autouse=True)
def mock_sleep(mocker):
# Stops tenacity from blocking lister tests when retrying
return mocker.patch("time.sleep")