Skip to content

Commit

Permalink
Update for new versions of docker-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
avirshup committed Apr 4, 2018
1 parent 19b89c9 commit d522eec
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
termcolor
docker >=3.0
docker >=3.2
future
pyyaml
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
]
},
install_requires=['termcolor',
'docker',
'docker>=3.2',
'future',
'pyyaml'],
)
8 changes: 6 additions & 2 deletions test/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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

0 comments on commit d522eec

Please sign in to comment.