MCPcopy Index your code
hub / github.com/docker/docker-py / test_prune_images

Method test_prune_images

tests/integration/api_image_test.py:304–328  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

302@requires_api_version('1.25')
303class PruneImagesTest(BaseAPIIntegrationTest):
304 def test_prune_images(self):
305 try:
306 self.client.remove_image('hello-world')
307 except docker.errors.APIError:
308 pass
309
310 # Ensure busybox does not get pruned
311 ctnr = self.client.create_container(TEST_IMG, ['sleep', '9999'])
312 self.tmp_containers.append(ctnr)
313
314 self.client.pull('hello-world', tag='latest')
315 self.tmp_imgs.append('hello-world')
316 img_id = self.client.inspect_image('hello-world')['Id']
317 result = self.client.prune_images()
318 assert img_id not in [
319 img.get('Deleted') for img in result.get('ImagesDeleted') or []
320 ]
321 result = self.client.prune_images({'dangling': False})
322 assert result['SpaceReclaimed'] > 0
323 assert 'hello-world:latest' in [
324 img.get('Untagged') for img in result['ImagesDeleted']
325 ]
326 assert img_id in [
327 img.get('Deleted') for img in result['ImagesDeleted']
328 ]
329
330
331class SaveLoadImagesTest(BaseAPIIntegrationTest):

Callers

nothing calls this directly

Calls 6

remove_imageMethod · 0.80
create_containerMethod · 0.80
inspect_imageMethod · 0.80
prune_imagesMethod · 0.80
pullMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected