Skip to content

Commit

Permalink
fix(ingest): upgrade pytest-docker (#9765)
Browse files Browse the repository at this point in the history
  • Loading branch information
hsheth2 authored Feb 2, 2024
1 parent 5331304 commit 0e418b5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion metadata-ingestion/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@
pytest_dep,
"pytest-asyncio>=0.16.0",
"pytest-cov>=2.8.1",
"pytest-docker>=1.0.1",
"pytest-docker>=1.1.0",
deepdiff_dep,
"requests-mock",
"freezegun",
Expand Down
20 changes: 12 additions & 8 deletions metadata-ingestion/tests/test_helpers/docker_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging
import os
import subprocess
from typing import Callable, Optional, Union
from typing import Callable, Iterator, List, Optional, Union

import pytest
import pytest_docker.plugin
Expand Down Expand Up @@ -37,9 +37,11 @@ def wait_for_port(
docker_services.wait_until_responsive(
timeout=timeout,
pause=pause,
check=checker
if checker
else lambda: is_responsive(container_name, container_port, hostname),
check=(
checker
if checker
else lambda: is_responsive(container_name, container_port, hostname)
),
)
logger.info(f"Container {container_name} is ready!")
finally:
Expand All @@ -62,14 +64,16 @@ def docker_compose_runner(
):
@contextlib.contextmanager
def run(
compose_file_path: Union[str, list], key: str, cleanup: bool = True
) -> pytest_docker.plugin.Services:
compose_file_path: Union[str, List[str]], key: str, cleanup: bool = True
) -> Iterator[pytest_docker.plugin.Services]:
with pytest_docker.plugin.get_docker_services(
docker_compose_command=docker_compose_command,
docker_compose_file=compose_file_path,
# We can remove the type ignore once this is merged:
# https://github.com/avast/pytest-docker/pull/108
docker_compose_file=compose_file_path, # type: ignore
docker_compose_project_name=f"{docker_compose_project_name}-{key}",
docker_setup=docker_setup,
docker_cleanup=docker_cleanup if cleanup else False,
docker_cleanup=docker_cleanup if cleanup else [],
) as docker_services:
yield docker_services

Expand Down

0 comments on commit 0e418b5

Please sign in to comment.