Skip to content

Commit 2085a0b

Browse files
authored
Changed "retry" dependency to "tenacity" (#342)
1 parent edbe791 commit 2085a0b

File tree

3 files changed

+28
-31
lines changed

3 files changed

+28
-31
lines changed

poetry.lock

Lines changed: 17 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ celery = { version = "*" }
7878
redis = { version = "*", optional = true }
7979
python-memcached = { version = "*", optional = true }
8080
python = ">=3.8,<4.0"
81-
retry = ">=0.9.2"
81+
tenacity = ">=8.5.0"
8282
pytest-docker-tools = ">=3.1.3"
8383
docker = "^7.1.0"
8484
psutil = ">=5.9.7"

src/pytest_celery/api/container.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
import pytest_docker_tools
1313
from pytest_docker_tools import wrappers
1414
from pytest_docker_tools.wrappers.container import wait_for_callable
15-
from retry import retry
15+
from tenacity import retry
16+
from tenacity import retry_if_exception_type
17+
from tenacity import stop_after_attempt
18+
from tenacity import wait_fixed
1619

1720

1821
class CeleryTestContainer(wrappers.Container):
@@ -115,7 +118,12 @@ def _wait_port(self, port: str) -> int:
115118
_, p = self.get_addr(port)
116119
return p
117120

118-
@retry(pytest_docker_tools.exceptions.TimeoutError, delay=10, tries=3)
121+
@retry(
122+
stop=stop_after_attempt(3),
123+
wait=wait_fixed(10),
124+
retry=retry_if_exception_type(pytest_docker_tools.exceptions.TimeoutError),
125+
reraise=True,
126+
)
119127
def _wait_ready(self, timeout: int = 30) -> bool:
120128
"""Wait for the container to be ready by polling the logs for the
121129
readiness prompt. If no prompt is set, the container is considered

0 commit comments

Comments
 (0)