From f77489b222e7434bab7eb0ec1bf19b5e02987a04 Mon Sep 17 00:00:00 2001 From: David Ankin Date: Tue, 23 Jan 2024 00:55:18 -0500 Subject: [PATCH] fix at least some tests on windows, see #415 --- core/testcontainers/core/container.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/testcontainers/core/container.py b/core/testcontainers/core/container.py index c3825b93..adb1c41d 100644 --- a/core/testcontainers/core/container.py +++ b/core/testcontainers/core/container.py @@ -1,4 +1,5 @@ import os +from platform import system from typing import Iterable, Optional, Tuple from docker.models.containers import Container @@ -103,6 +104,9 @@ def get_container_host_ip(self) -> str: if gateway_ip == host: return self.get_docker_client().bridge_ip(self._container.id) return gateway_ip + # see https://github.com/testcontainers/testcontainers-python/issues/415 + if host == "localnpipe" and "Windows" == system(): + return "localhost" return host @wait_container_is_ready()