File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ def __init__(self,
9595 self ._client = None
9696
9797 self ._tlocal = threading .local ()
98+ super (S3FS , self ).__init__ ()
9899
99100 def __repr__ (self ):
100101 return _make_repr (
@@ -219,6 +220,10 @@ def listdir(self, path):
219220 if name :
220221 _directory .append (name )
221222
223+ if not _directory :
224+ if not self .getinfo (path ).is_dir :
225+ raise errors .DirectoryExpected (path )
226+
222227 return _directory
223228
224229 def makedir (self , path , permission = None , recreate = False ):
@@ -318,4 +323,4 @@ def removedir(self, path):
318323 )
319324
320325 def setinfo (self , path , info ):
321- pass
326+ getinfo ( path )
Original file line number Diff line number Diff line change 1+ from __future__ import unicode_literals
2+
3+ import unittest
4+
5+ from fs .test import FSTestCases
6+
7+ from s3fs import S3FS
8+
9+ import boto3
10+
11+ class TestMemoryFS (FSTestCases , unittest .TestCase ):
12+ """Test OSFS implementation."""
13+ bucket_name = 'fsexample'
14+ s3 = boto3 .resource ('s3' )
15+ client = boto3 .client ('s3' )
16+
17+ def make_fs (self ):
18+ self ._delete_bucket_contents ()
19+ return S3FS (self .bucket_name )
20+
21+ def _delete_bucket_contents (self ):
22+ response = self .client .list_objects (
23+ Bucket = self .bucket_name
24+ )
25+ contents = response .get ("Contents" , ())
26+ for obj in contents :
27+ self .client .delete_object (
28+ Bucket = self .bucket_name ,
29+ Key = obj ["Key" ]
30+ )
31+
32+ def destroy_fs (self , fs ):
33+ pass
You can’t perform that action at this time.
0 commit comments