Skip to content

Commit c058fd0

Browse files
committed
check if env variable is set correctly
1 parent 103168d commit c058fd0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

testcontainers/core/container.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ def __del__(self):
8080
def get_container_host_ip(self) -> str:
8181
# https://github.com/testcontainers/testcontainers-go/blob/dd76d1e39c654433a3d80429690d07abcec04424/docker.go#L644
8282
# if os env TC_HOST is set, use it
83-
if os.environ.get('TC_HOST') is not None:
84-
return os.environ.get('TC_HOST')
83+
host = os.environ.get('TC_HOST')
84+
if host:
85+
return host
8586

8687
# infer from docker host
8788
url = self.get_docker_client().host()

0 commit comments

Comments
 (0)