Commit 396d635e by rfkelly0

more adjustments for new "close" method

parent d74ba1ec
......@@ -15,7 +15,7 @@ implementations of this interface such as:
"""
__version__ = "0.2.0a5"
__version__ = "0.2.0a6"
__author__ = "Will McGugan (will@willmcgugan.com)"
# 'base' imports * from 'path' and 'errors', so their
......
......@@ -701,6 +701,7 @@ class SubFS(FS):
def __init__(self, parent, sub_dir):
self.parent = parent
self.sub_dir = abspath(normpath(sub_dir))
FS.__init__(self,thread_synchronize=False)
def __str__(self):
return "<SubFS: %s in %s>" % (self.sub_dir, self.parent)
......
......@@ -106,6 +106,7 @@ class RPCFS(FS):
self.uri = uri
self._transport = transport
self.proxy = self._make_proxy()
FS.__init__(self,thread_synchronize=False)
def _make_proxy(self):
kwds = dict(allow_none=True)
......
......@@ -46,13 +46,13 @@ class DisconnectingFS(WrapFS):
def __init__(self,fs=None):
if fs is None:
fs = TempFS()
super(DisconnectingFS,self).__init__(fs)
self._connected = random.choice([True,False])
if not self._connected:
raise RemoteConnectionError("")
self._connected = True
self._continue = True
self._bounce_thread = threading.Thread(target=self._bounce)
self._bounce_thread.start()
super(DisconnectingFS,self).__init__(fs)
if random.choice([True,False]):
raise RemoteConnectionError("")
def __getstate__(self):
state = super(DisconnectingFS,self).__getstate__()
......@@ -70,13 +70,17 @@ class DisconnectingFS(WrapFS):
self._connected = not self._connected
def close(self):
self._continue = False
self._bounce_thread.join()
self._connected = True
self.wrapped_fs.close()
if not self.closed:
self._continue = False
self._bounce_thread.join()
self._connected = True
self.wrapped_fs.close()
super(DisconnectingFS,self).close()
def disconnecting_wrapper(func):
"""Method wrapper to raise RemoteConnectionError if not connected."""
if func.__name__ == "close":
return func
@wraps(func)
def wrapper(self,*args,**kwds):
if not self._connected:
......
......@@ -27,11 +27,11 @@ class TestS3FS(unittest.TestCase,FSTestCases,ThreadingTestCases):
self.fs._s3bukt.delete_key(k)
def test_concurrent_copydir(self):
# makdir() on S3FS is currently not atomic
# makedir() on S3FS is currently not atomic
pass
def test_makedir_winner(self):
# makdir() on S3FS is currently not atomic
# makedir() on S3FS is currently not atomic
pass
def test_multiple_overwrite(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment