diff options
author | Joffrey F <f.joffrey@gmail.com> | 2018-02-23 13:34:55 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-23 13:34:55 -0800 |
commit | 8b246db271a85d6541dc458838627e89c683e42f (patch) | |
tree | ede6d0a06ccd417d217cfd108feb9a759dd1010c | |
parent | d41e06092dd228c2409c61b0d6ed60d2b83eb5c5 (diff) | |
parent | ab1f90a379bfb781c821ba8210e76bfa5551ea60 (diff) | |
download | docker-py-8b246db271a85d6541dc458838627e89c683e42f.tar.gz |
Merge pull request #1922 from yongtang/02232018-cleanup
Cleanup containers during the tests
-rw-r--r-- | tests/integration/base.py | 2 | ||||
-rw-r--r-- | tests/integration/models_containers_test.py | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/tests/integration/base.py b/tests/integration/base.py index c22126d..56c23ed 100644 --- a/tests/integration/base.py +++ b/tests/integration/base.py @@ -36,7 +36,7 @@ class BaseIntegrationTest(unittest.TestCase): pass for container in self.tmp_containers: try: - client.api.remove_container(container, force=True) + client.api.remove_container(container, force=True, v=True) except docker.errors.APIError: pass for network in self.tmp_networks: diff --git a/tests/integration/models_containers_test.py b/tests/integration/models_containers_test.py index f9f59c4..fac4de2 100644 --- a/tests/integration/models_containers_test.py +++ b/tests/integration/models_containers_test.py @@ -47,10 +47,13 @@ class ContainerCollectionTest(BaseIntegrationTest): self.tmp_containers.append(container.id) container.wait() + name = "container_volume_test" out = client.containers.run( "alpine", "cat /insidecontainer/test", - volumes=["%s:/insidecontainer" % path] + volumes=["%s:/insidecontainer" % path], + name=name ) + self.tmp_containers.append(name) assert out == b'hello\n' def test_run_with_named_volume(self): @@ -66,10 +69,13 @@ class ContainerCollectionTest(BaseIntegrationTest): self.tmp_containers.append(container.id) container.wait() + name = "container_volume_test" out = client.containers.run( "alpine", "cat /insidecontainer/test", - volumes=["somevolume:/insidecontainer"] + volumes=["somevolume:/insidecontainer"], + name=name ) + self.tmp_containers.append(name) assert out == b'hello\n' def test_run_with_network(self): |