Skip to content

Commit

Permalink
Tests, tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Aug 29, 2017
1 parent bc5a8cf commit f30887c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ test:
nosetests --with-coverage --cover-erase --cover-package=fs_s3fs -a "!slow" fs_s3fs/tests
rm .coverage

.PHONY: slowtest
slowtest:
nosetests --with-coverage --cover-erase --cover-package=fs_s3fs fs_s3fs/tests
rm .coverage

.PHONY: testall
testall:
tox
Expand Down
9 changes: 4 additions & 5 deletions fs_s3fs/_s3fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ def _info_from_object(self, obj, namespaces):
if isinstance(value, datetime):
value = datetime_to_epoch(value)
s3info[name] = value

if 'urls' in namespaces:
url = self.client.generate_presigned_url(
ClientMethod='get_object',
Expand All @@ -387,8 +386,6 @@ def _info_from_object(self, obj, namespaces):
info['urls'] = {
'download': url
}


return info

def getinfo(self, path, namespaces=None):
Expand Down Expand Up @@ -483,7 +480,8 @@ def openbin(self, path, mode="r", buffering=-1, **options):

if _mode.create:

def on_close(s3file):
def on_close_create(s3file):
"""Called when the S3 file closes, to upload data."""
try:
s3file.raw.seek(0)
with s3errors(path):
Expand All @@ -503,7 +501,7 @@ def on_close(s3file):
if info.is_dir:
raise errors.FileExpected(path)

s3file = S3File.factory(path, _mode, on_close=on_close)
s3file = S3File.factory(path, _mode, on_close=on_close_create)
if _mode.appending:
try:
with s3errors(path):
Expand All @@ -522,6 +520,7 @@ def on_close(s3file):
raise errors.FileExpected(path)

def on_close(s3file):
"""Called when the S3 file closes, to upload the data."""
try:
if _mode.writing:
s3file.raw.seek(0, os.SEEK_SET)
Expand Down
1 change: 1 addition & 0 deletions fs_s3fs/tests/test_s3fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def _delete_bucket_contents(self):
Key=obj["Key"]
)


@attr('slow')
class TestS3FSSubDir(FSTestCases, unittest.TestCase):
"""Test S3FS implementation from dir_path."""
Expand Down

0 comments on commit f30887c

Please sign in to comment.