Tests for NB_UID, NB_GID, GRANT_SUDO options

* Improve test container teardown
* Fix needless groupmod when NB_GID is unchanged
This commit is contained in:
Peter Parente
2017-11-30 00:15:17 -05:00
parent 8a59d74813
commit b9139131da
3 changed files with 62 additions and 27 deletions

View File

@@ -75,10 +75,10 @@ class TrackedContainer(object):
self.container = self.docker_client.containers.run(self.image_name, **all_kwargs)
return self.container
def kill(self):
"""Kills the tracked docker container."""
def remove(self):
"""Kills and removes the tracked docker container."""
if self.container:
self.container.kill()
self.container.remove(force=True)
@pytest.fixture(scope='function')
@@ -92,10 +92,9 @@ def container(docker_client, image_name):
docker_client,
image_name,
detach=True,
auto_remove=False,
ports={
'8888/tcp': 8888
}
)
yield container
container.kill()
container.remove()