You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Size limits (OSError Errno 28) causing content do disappear. Content that has been flushed to the file disappears after a further failed write.
The following test should pass:
deftest_fake_fs(fs):
fs.set_disk_usage(100) # sets the file system size in bytesos.makedirs("/foo")
withopen('/foo/bar.txt', 'wb') asf:
f.write(b'a'*50)
f.flush()
# By this point 50 bytes must be "committed" into the file whatever happens next.withopen('/foo/bar.txt', "rb") asr:
x=r.read()
# Yes, it's there!assertx.startswith(b'a'*50)
withpytest.raises(OSError):
f.write(b'b'*200)
f.flush()
withopen('/foo/bar.txt', "rb") asr:
x=r.read()
# Wait, where did it goassertx.startswith(b'a'*50)
# Because of the above assertion failure, the truncate never happensf.truncate(50)
# The implicit close causes another OSError because of the missing truncate().
Apologies, I've just spotted the above test should fail but for different reasons. With buffered file access, the truncate() would also fail. But the above assertion failure is still wrong. There's no way that the file should randomly blank like that.
couling
changed the title
Flush doesn't seem to have any proper effect.
Size limits (OSError Errno 28) causing content do disappear
Aug 25, 2020
Size limits (OSError Errno 28) causing content do disappear. Content that has been flushed to the file disappears after a further failed write.
The following test should pass:
My enviroment
The text was updated successfully, but these errors were encountered: