From d522eec9dd7063f4963b350418d87f58de9976d4 Mon Sep 17 00:00:00 2001 From: Aaron Virshup Date: Wed, 4 Apr 2018 13:59:35 -0700 Subject: [PATCH] Update for new versions of docker-sdk --- requirements.txt | 2 +- setup.py | 2 +- test/helpers.py | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index 1e3b65b..5742750 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ termcolor -docker >=3.0 +docker >=3.2 future pyyaml diff --git a/setup.py b/setup.py index cf1b54f..fa738d0 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ ] }, install_requires=['termcolor', - 'docker', + 'docker>=3.2', 'future', 'pyyaml'], ) diff --git a/test/helpers.py b/test/helpers.py index 364fb29..a706e64 100644 --- a/test/helpers.py +++ b/test/helpers.py @@ -33,7 +33,10 @@ def fixture(): yield for name in imgnames: # force it to also remove the containers - client.images.remove(name, force=True) + try: + client.images.remove(name, force=True) + except docker.errors.ImageNotFound: + pass return fixture @@ -51,10 +54,11 @@ def assert_file_content(imgname, path, content): try: tarstream, stat = container.get_archive(path) + actual_content = b''.join(tarstream) except docker.errors.NotFound: assert False, 'File %s not found' % path container.remove() - tf = tarfile.open(fileobj=io.BytesIO(tarstream.read())) + tf = tarfile.open(fileobj=io.BytesIO(actual_content)) val = tf.extractfile(os.path.basename(path)).read().decode('utf-8') assert val.strip() == content