Skip to content

Commit f30887c

Browse files
committed
Tests, tidy
1 parent bc5a8cf commit f30887c

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ test:
1111
nosetests --with-coverage --cover-erase --cover-package=fs_s3fs -a "!slow" fs_s3fs/tests
1212
rm .coverage
1313

14+
.PHONY: slowtest
15+
slowtest:
16+
nosetests --with-coverage --cover-erase --cover-package=fs_s3fs fs_s3fs/tests
17+
rm .coverage
18+
1419
.PHONY: testall
1520
testall:
1621
tox

fs_s3fs/_s3fs.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,6 @@ def _info_from_object(self, obj, namespaces):
375375
if isinstance(value, datetime):
376376
value = datetime_to_epoch(value)
377377
s3info[name] = value
378-
379378
if 'urls' in namespaces:
380379
url = self.client.generate_presigned_url(
381380
ClientMethod='get_object',
@@ -387,8 +386,6 @@ def _info_from_object(self, obj, namespaces):
387386
info['urls'] = {
388387
'download': url
389388
}
390-
391-
392389
return info
393390

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

484481
if _mode.create:
485482

486-
def on_close(s3file):
483+
def on_close_create(s3file):
484+
"""Called when the S3 file closes, to upload data."""
487485
try:
488486
s3file.raw.seek(0)
489487
with s3errors(path):
@@ -503,7 +501,7 @@ def on_close(s3file):
503501
if info.is_dir:
504502
raise errors.FileExpected(path)
505503

506-
s3file = S3File.factory(path, _mode, on_close=on_close)
504+
s3file = S3File.factory(path, _mode, on_close=on_close_create)
507505
if _mode.appending:
508506
try:
509507
with s3errors(path):
@@ -522,6 +520,7 @@ def on_close(s3file):
522520
raise errors.FileExpected(path)
523521

524522
def on_close(s3file):
523+
"""Called when the S3 file closes, to upload the data."""
525524
try:
526525
if _mode.writing:
527526
s3file.raw.seek(0, os.SEEK_SET)

fs_s3fs/tests/test_s3fs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def _delete_bucket_contents(self):
3232
Key=obj["Key"]
3333
)
3434

35+
3536
@attr('slow')
3637
class TestS3FSSubDir(FSTestCases, unittest.TestCase):
3738
"""Test S3FS implementation from dir_path."""

0 commit comments

Comments
 (0)