summaryrefslogtreecommitdiff
path: root/tests/integration/models_images_test.py
diff options
context:
space:
mode:
authorJoffrey F <joffrey@docker.com>2018-01-29 19:10:12 -0800
committerJoffrey F <joffrey@docker.com>2018-01-30 14:26:24 -0800
commit342221130918f4525f01e31d3697cfc077df090e (patch)
treeecec590176339d863a51d78837c231bb4fa735fd /tests/integration/models_images_test.py
parent4ff296247b4ed9c4afbb0b5293bd4deecb4fe708 (diff)
downloaddocker-py-pytest-asserts.tar.gz
Use pytest assertspytest-asserts
Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'tests/integration/models_images_test.py')
-rw-r--r--tests/integration/models_images_test.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/integration/models_images_test.py b/tests/integration/models_images_test.py
index 94164ce..9313916 100644
--- a/tests/integration/models_images_test.py
+++ b/tests/integration/models_images_test.py
@@ -21,16 +21,15 @@ class ImageCollectionTest(BaseIntegrationTest):
# @pytest.mark.xfail(reason='Engine 1.13 responds with status 500')
def test_build_with_error(self):
client = docker.from_env(version=TEST_API_VERSION)
- with self.assertRaises(docker.errors.BuildError) as cm:
+ with pytest.raises(docker.errors.BuildError) as cm:
client.images.build(fileobj=io.BytesIO(
"FROM alpine\n"
"RUN exit 1".encode('ascii')
))
- print(cm.exception)
- assert str(cm.exception) == (
+ assert (
"The command '/bin/sh -c exit 1' returned a non-zero code: 1"
- )
- assert cm.exception.build_log
+ ) in cm.exconly()
+ assert cm.value.build_log
def test_build_with_multiple_success(self):
client = docker.from_env(version=TEST_API_VERSION)