Skip to content

Commit 08916c8

Browse files
christianaaronschroederalexanderankin
andauthoredMay 14, 2024··
fix(core): add empty _configure to DockerContainer (#556)
I've used DbContainer in the past as a parent to a class where I redefined `_configure()` and did not redefine `start()`. I'm now using DockerContainer and wanted to follow the same pattern but it doesn't have a `_configure()` function called in `start()`. I figure this gives the easy option without being invasive? tests pass --------- Co-authored-by: David Ankin <daveankin@gmail.com>
1 parent 3c8006c commit 08916c8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
 

‎core/testcontainers/core/container.py

+5
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ def start(self) -> Self:
8787
Reaper.get_instance()
8888
logger.info("Pulling image %s", self.image)
8989
docker_client = self.get_docker_client()
90+
self._configure()
9091
self._container = docker_client.run(
9192
self.image,
9293
command=self._command,
@@ -176,6 +177,10 @@ def exec(self, command) -> tuple[int, str]:
176177
raise ContainerStartException("Container should be started before executing a command")
177178
return self._container.exec_run(command)
178179

180+
def _configure(self) -> None:
181+
# placeholder if subclasses want to define this and use the default start method
182+
pass
183+
179184

180185
class Reaper:
181186
_instance: "Optional[Reaper]" = None

0 commit comments

Comments
 (0)
Please sign in to comment.