Skip to content

Commit

Permalink
Fix test suite for Boto on PY3, which only supports tempfile.NamedTem…
Browse files Browse the repository at this point in the history
…poraryFile and not tempfile.TemporaryFile
  • Loading branch information
amol- committed Nov 25, 2014
1 parent b714dae commit eeacc9e
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion depot/io/awss3.py
Expand Up @@ -140,7 +140,6 @@ def exists(self, file_or_id):
return k is not None



def _check_file_id(file_id):
# Check that the given file id is valid, this also
# prevents unsafe paths.
Expand Down
1 change: 0 additions & 1 deletion tests/__init__.py
@@ -1 +0,0 @@

3 changes: 2 additions & 1 deletion tests/test_awss3_storage.py
Expand Up @@ -64,7 +64,8 @@ def test_public_url(self):
key.set_contents_from_string(FILE_CONTENT)

f = self.fs.get(fid)
assert f.public_url.endswith('.s3.amazonaws.com/%s' % fid)
assert '.s3.amazonaws.com' in f.public_url, f.public_url
assert f.public_url.endswith('/%s' % fid), f.public_url

def teardown(self):
keys = [key.name for key in self.fs._bucket]
Expand Down
4 changes: 2 additions & 2 deletions tests/test_storage_interface.py
Expand Up @@ -5,7 +5,7 @@
import mock
import datetime
from io import BytesIO
from tempfile import TemporaryFile, NamedTemporaryFile
from tempfile import NamedTemporaryFile
import os
from tests.utils import create_cgifs

Expand Down Expand Up @@ -41,7 +41,7 @@ def test_invalidid(self):
f = self.fs.get('NOTANID')

def test_creation_inputs(self):
temp = TemporaryFile()
temp = NamedTemporaryFile()
temp.write(FILE_CONTENT)
temp.seek(0)

Expand Down
2 changes: 1 addition & 1 deletion tests/utils.py
Expand Up @@ -10,7 +10,7 @@ def create_cgifs(mimetype, content, filename):
if hasattr(content, 'read'):
fs.file = content
else:
fs.file = tempfile.TemporaryFile(mode='w+b')
fs.file = tempfile.NamedTemporaryFile(mode='w+b')
fs.file.write(content)

fs.file.seek(0)
Expand Down

0 comments on commit eeacc9e

Please sign in to comment.