Commit f001445d by rfkelly0

make LimitSizeFS more robust

parent 92e3024b
...@@ -971,6 +971,9 @@ class FS(object): ...@@ -971,6 +971,9 @@ class FS(object):
try: try:
src_file = self.open(src, "rb") src_file = self.open(src, "rb")
self.setcontents(dst, src_file, chunk_size=chunk_size) self.setcontents(dst, src_file, chunk_size=chunk_size)
except ResourceNotFoundError:
if self.exists(src) and not self.exists(dirname(dst)):
raise ParentDirectoryMissingError(dst)
finally: finally:
if src_file is not None: if src_file is not None:
src_file.close() src_file.close()
......
...@@ -788,7 +788,7 @@ class FSTestCases(object): ...@@ -788,7 +788,7 @@ class FSTestCases(object):
def test_big_file(self): def test_big_file(self):
"""Test big files (1MB)""" """Test handling of a big file (1MB)"""
chunk_size = 1024 * 256 chunk_size = 1024 * 256
num_chunks = 4 num_chunks = 4
def chunk_stream(): def chunk_stream():
......
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