Commit 8d556b25 by rfkelly0

properly support append-mode in RemoteFileBuffer

parent bb78b068
...@@ -75,7 +75,7 @@ class RemoteFileBuffer(object): ...@@ -75,7 +75,7 @@ class RemoteFileBuffer(object):
self._lock = fs._lock.__class__() self._lock = fs._lock.__class__()
else: else:
self._lock = threading.RLock() self._lock = threading.RLock()
if "r" in mode or "+" in mode: if "r" in mode or "+" in mode or "a" in mode:
if rfile is not None: if rfile is not None:
if hasattr(rfile,"read"): if hasattr(rfile,"read"):
data = rfile.read(1024*256) data = rfile.read(1024*256)
......
...@@ -404,8 +404,10 @@ class FSTestCases: ...@@ -404,8 +404,10 @@ class FSTestCases:
f2.close() f2.close()
self.assert_(checkcontents("b.txt", test_strings[0])) self.assert_(checkcontents("b.txt", test_strings[0]))
f3 = self.fs.open("b.txt", "ab") f3 = self.fs.open("b.txt", "ab")
self.assertEquals(f3.tell(),len(test_strings[0]))
f3.write(test_strings[1]) f3.write(test_strings[1])
f3.write(test_strings[2]) f3.write(test_strings[2])
self.assertEquals(f3.tell(),len(all_strings))
f3.close() f3.close()
self.assert_(checkcontents("b.txt", all_strings)) self.assert_(checkcontents("b.txt", all_strings))
f4 = self.fs.open("b.txt", "wb") f4 = self.fs.open("b.txt", "wb")
......
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