From 342221130918f4525f01e31d3697cfc077df090e Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Mon, 29 Jan 2018 19:10:12 -0800 Subject: Use pytest asserts Signed-off-by: Joffrey F --- tests/integration/models_images_test.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'tests/integration/models_images_test.py') 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) -- cgit v1.2.1