Skip to content

Commit 8eff908

Browse files
fix: fix pr #961 (#1011)
fix #961
1 parent be9a0a6 commit 8eff908

5 files changed

Lines changed: 6 additions & 5 deletions

File tree

core/testcontainers/core/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def _render_bool(self, env_name: str, prop_name: str) -> bool:
114114
https://github.com/testcontainers/testcontainers-go/blob/dd76d1e39c654433a3d80429690d07abcec04424/docker.go#L644
115115
if os env TC_HOST is set, use it
116116
"""
117-
hub_image_name_prefix: str = environ.get("TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX", "")
117+
hub_image_name_prefix: str = field(default_factory=lambda: environ.get("TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX", ""))
118118
""" Prefix to use for hub image names, e.g. for private registries. """
119119

120120
@property

core/testcontainers/core/container.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import pathlib
44
import sys
55
import tarfile
6-
from os import PathLike, getenv
6+
from os import PathLike
77
from socket import socket
88
from types import TracebackType
99
from typing import TYPE_CHECKING, Any, Optional, TypedDict, Union, cast

core/tests/test_compose.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ def test_compose_normalize_rewrites_local_url_for_ssh_docker_host(
408408
result = model.normalize()
409409
assert result.URL == expected_url
410410
assert result.PublishedPort == 9999
411-
411+
412412

413413
def test_container_info():
414414
"""Test get_container_info functionality"""

core/tests/test_config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,16 @@ def test_read_tc_properties(monkeypatch: MonkeyPatch) -> None:
2727
config = TCC()
2828
assert config.tc_properties == {"tc.host": "some_value"}
2929

30+
3031
def test_hub_image_name_prefix(monkeypatch: MonkeyPatch) -> None:
3132
"""
3233
Ensure that the hub_image_name_prefix configuration variable can be read from the environment
3334
"""
3435
monkeypatch.setenv("TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX", "myregistry.local/")
3536
config = TCC()
3637
assert config.hub_image_name_prefix == "myregistry.local/"
37-
38+
39+
3840
def test_set_tc_properties(monkeypatch: MonkeyPatch) -> None:
3941
"""
4042
Ensure the configuration file variables can be read if no environment variable is set
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-

0 commit comments

Comments
 (0)