File tree 2 files changed +15
-4
lines changed
2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ def maybe_emulate_amd64(self) -> Self:
88
88
return self
89
89
90
90
def start (self ) -> Self :
91
+ breakpoint ()
91
92
def _start ():
92
93
docker_client = self .get_docker_client ()
93
94
self ._container = docker_client .run (
@@ -146,8 +147,7 @@ def _start():
146
147
def stop (self , force = True , delete_volume = True ) -> None :
147
148
if self ._container :
148
149
if self ._reuse and c .reuse_enabled :
149
- #self._container.stop()
150
- return
150
+ self ._container .stop ()
151
151
else :
152
152
self ._container .remove (force = force , v = delete_volume )
153
153
self .get_docker_client ().client .close ()
Original file line number Diff line number Diff line change @@ -20,10 +20,21 @@ def test_docker_container_with_reuse_reuse_disabled():
20
20
assert id not in [container .id for container in containers ]
21
21
22
22
23
- def test_docker_container_with_reuse_reuse_enabled (monkeypatch ):
23
+ def test_docker_container_with_reuse_reuse_enabled_ryuk_enabled (monkeypatch ):
24
+ monkeypatch .setattr ("testcontainers.core.config.testcontainers_config.reuse_enabled" , True )
25
+ with DockerContainer ("hello-world" ).with_reuse () as container :
26
+ assert container ._reuse == True
27
+ id = container ._container .id
28
+ containers = DockerClient ().client .containers .list (all = True )
29
+ assert id in [container .id for container in containers ]
30
+
31
+
32
+ # TODO: do not run test while ryuk is running
33
+ # TODO: clean up container after test run
34
+ def test_docker_container_with_reuse_reuse_enabled_ryuk_diabled (monkeypatch ):
24
35
monkeypatch .setattr ("testcontainers.core.config.testcontainers_config.reuse_enabled" , True )
25
36
monkeypatch .setattr ("testcontainers.core.config.testcontainers_config.ryuk_disabled" , True )
26
- with DockerContainer ("postgres" , auto_remove = False ).with_reuse () as container :
37
+ with DockerContainer ("hello-world" ).with_reuse () as container :
27
38
assert container ._reuse == True
28
39
id = container ._container .id
29
40
containers = DockerClient ().client .containers .list (all = True )
You can’t perform that action at this time.
0 commit comments