Skip to content

Commit 42f6d41

Browse files
kiviewbstrausser
authored andcommitted
fix(configuration): strip whitespaces when reading .testcontainers.properties (testcontainers#474)
## What does this PR do? Strip whitespaces from key and value after reading `~/.testcontainers.properties`. The way TCD writes this file, the `=` will be surrounded by whitespaces, e.g.: ``` kiview@kay ~ % cat .testcontainers.properties tc.host = tcp://127.0.0.1:59499 testcontainers.reuse.enable = true ``` ## Why is it important? Adds Plug&Play support for Testcontainers Desktop and Testcontainers Cloud. ## How to test this PR Run any kind of tests that involve creating and starting containers, while Testcontainers Desktop is running. Testcontainers Desktop should be used and hence started containers can be seen in the Testcontainers Cloud dashboard.
1 parent 298be8c commit 42f6d41

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/testcontainers/core/docker_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def read_tc_properties() -> dict[str, str]:
143143
tuples = []
144144
with open(file) as contents:
145145
tuples = [line.split("=") for line in contents.readlines() if "=" in line]
146-
settings = {**settings, **{item[0]: item[1] for item in tuples}}
146+
settings = {**settings, **{item[0].strip(): item[1].strip() for item in tuples}}
147147
return settings
148148

149149

0 commit comments

Comments
 (0)