Skip to content

Commit

Permalink
Improved ready logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Nusnus committed Oct 12, 2023
1 parent fb786a2 commit 1b0ec5f
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/pytest_celery/api/container.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys

Check warning on line 1 in src/pytest_celery/api/container.py

View check run for this annotation

Codecov / codecov/patch

src/pytest_celery/api/container.py#L1

Added line #L1 was not covered by tests
from typing import Any
from typing import Optional

Expand Down Expand Up @@ -38,14 +39,14 @@ def _wait_port(self, port: str) -> int:

@retry(pytest_docker_tools.exceptions.TimeoutError, delay=10, tries=3)
def _wait_ready(self, timeout: int = 30) -> bool:
if self.ready_prompt is None:
return True

wait_for_callable(
f"Waiting for {self.__class__.__name__}::{self.name} to get ready",
lambda: self.ready_prompt in self.logs(),
timeout=timeout,
)
if self.ready_prompt is not None:
wait_for_callable(
f"Waiting for {self.__class__.__name__}::{self.name} to get ready",
lambda: self.ready_prompt in self.logs(),
timeout=timeout,
)

sys.stdout.write(f"{self.__class__.__name__}::{self.name} is ready\n")

return True

Expand Down

0 comments on commit 1b0ec5f

Please sign in to comment.