Skip to content

Commit 7a7ea48

Browse files
warn user if ryuk is disabled but with_reuse used
1 parent 6e3029e commit 7a7ea48

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

core/testcontainers/core/container.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,13 @@ def start(self) -> Self:
108108
hash_ = hashlib.sha256(bytes(str(args), encoding="utf-8")).hexdigest()
109109

110110
# TODO: check also if ryuk is disabled
111-
if self._reuse and not c.tc_properties_testcontainers_reuse_enable:
111+
if self._reuse and (not c.tc_properties_testcontainers_reuse_enable or not c.ryuk_disabled):
112112
logging.warning(
113113
"Reuse was requested (`with_reuse`) but the environment does not "
114114
+ "support the reuse of containers. To enable container reuse, add "
115-
+ "the property 'testcontainers.reuse.enable=true' to a file at "
116-
+ "~/.testcontainers.properties (you may need to create it)."
115+
+ "the 'testcontainers.reuse.enable=true' to "
116+
+ "'~/.testcontainers.properties' and disable ryuk by setting the "
117+
+ "environment variable 'TESTCONTAINERS_RYUK_DISABLED=true'"
117118
)
118119

119120
if self._reuse and c.tc_properties_testcontainers_reuse_enable:

0 commit comments

Comments
 (0)