Merge branch 'main' into commit_pause

This commit is contained in:
Milas Bowman 2023-08-14 14:42:48 -04:00 committed by GitHub
commit 311adee7ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 11 deletions

View File

@ -1,6 +1,6 @@
# Docker SDK for Python # Docker SDK for Python
[![Build Status](https://github.com/docker/docker-py/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/docker/docker-py/actions/workflows/ci.yml/) [![Build Status](https://github.com/docker/docker-py/actions/workflows/ci.yml/badge.svg)](https://github.com/docker/docker-py/actions/workflows/ci.yml)
A Python library for the Docker Engine API. It lets you do anything the `docker` command does, but from within Python apps run containers, manage containers, manage Swarms, etc. A Python library for the Docker Engine API. It lets you do anything the `docker` command does, but from within Python apps run containers, manage containers, manage Swarms, etc.

View File

@ -5,8 +5,8 @@ ARG PYTHON_VERSION=3.10
FROM python:${PYTHON_VERSION} FROM python:${PYTHON_VERSION}
ARG APT_MIRROR ARG APT_MIRROR
RUN sed -ri "s/(httpredir|deb).debian.org/${APT_MIRROR:-deb.debian.org}/g" /etc/apt/sources.list \ RUN sed -ri "s/(httpredir|deb).debian.org/${APT_MIRROR:-deb.debian.org}/g" /etc/apt/sources.list.d/debian.sources \
&& sed -ri "s/(security).debian.org/${APT_MIRROR:-security.debian.org}/g" /etc/apt/sources.list && sed -ri "s/(security).debian.org/${APT_MIRROR:-security.debian.org}/g" /etc/apt/sources.list.d/debian.sources
RUN apt-get update && apt-get -y install --no-install-recommends \ RUN apt-get update && apt-get -y install --no-install-recommends \
gnupg2 \ gnupg2 \

View File

@ -122,8 +122,8 @@ class CreateContainerTest(BaseAPIIntegrationTest):
self.client.wait(id) self.client.wait(id)
with pytest.raises(docker.errors.APIError) as exc: with pytest.raises(docker.errors.APIError) as exc:
self.client.remove_container(id) self.client.remove_container(id)
err = exc.value.explanation err = exc.value.explanation.lower()
assert 'You cannot remove ' in err assert 'stop the container before' in err
self.client.remove_container(id, force=True) self.client.remove_container(id, force=True)
def test_create_container_with_volumes_from(self): def test_create_container_with_volumes_from(self):
@ -1392,7 +1392,7 @@ class GetContainerStatsTest(BaseAPIIntegrationTest):
response = self.client.stats(container, stream=0) response = self.client.stats(container, stream=0)
self.client.kill(container) self.client.kill(container)
assert type(response) == dict assert isinstance(response, dict)
for key in ['read', 'networks', 'precpu_stats', 'cpu_stats', for key in ['read', 'networks', 'precpu_stats', 'cpu_stats',
'memory_stats', 'blkio_stats']: 'memory_stats', 'blkio_stats']:
assert key in response assert key in response
@ -1405,7 +1405,7 @@ class GetContainerStatsTest(BaseAPIIntegrationTest):
self.client.start(container) self.client.start(container)
stream = self.client.stats(container) stream = self.client.stats(container)
for chunk in stream: for chunk in stream:
assert type(chunk) == dict assert isinstance(chunk, dict)
for key in ['read', 'network', 'precpu_stats', 'cpu_stats', for key in ['read', 'network', 'precpu_stats', 'cpu_stats',
'memory_stats', 'blkio_stats']: 'memory_stats', 'blkio_stats']:
assert key in chunk assert key in chunk

View File

@ -32,7 +32,7 @@ class ListImagesTest(BaseAPIIntegrationTest):
def test_images_quiet(self): def test_images_quiet(self):
res1 = self.client.images(quiet=True) res1 = self.client.images(quiet=True)
assert type(res1[0]) == str assert isinstance(res1[0], str)
class PullImageTest(BaseAPIIntegrationTest): class PullImageTest(BaseAPIIntegrationTest):
@ -43,7 +43,7 @@ class PullImageTest(BaseAPIIntegrationTest):
pass pass
res = self.client.pull('hello-world') res = self.client.pull('hello-world')
self.tmp_imgs.append('hello-world') self.tmp_imgs.append('hello-world')
assert type(res) == str assert isinstance(res, str)
assert len(self.client.images('hello-world')) >= 1 assert len(self.client.images('hello-world')) >= 1
img_info = self.client.inspect_image('hello-world') img_info = self.client.inspect_image('hello-world')
assert 'Id' in img_info assert 'Id' in img_info

View File

@ -9,7 +9,7 @@ class ErrorsTest(BaseAPIIntegrationTest):
self.client.start(container['Id']) self.client.start(container['Id'])
with pytest.raises(APIError) as cm: with pytest.raises(APIError) as cm:
self.client.remove_container(container['Id']) self.client.remove_container(container['Id'])
explanation = cm.value.explanation explanation = cm.value.explanation.lower()
assert 'You cannot remove a running container' in explanation assert 'stop the container before' in explanation
assert '{"message":' not in explanation assert '{"message":' not in explanation
self.client.remove_container(container['Id'], force=True) self.client.remove_container(container['Id'], force=True)