-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
open with w and a, write/seek/truncate/tell #300
Comments
Hm, can't reproduce this one. I get 6 in pyfakefs. |
oops, reversed pyfakefs and os! |
updated |
Hm, I don't understand why it shall be 7 - why not 6? After writing 6 bytes the position shall not have moved - what am I missing? |
Not sure. This extension produces the same file contents, but the tell result is different. component0 = "alpha" Hrm. |
Hmm. Have to understand this first, otherwise I have no idea how to fix it... I can reproduce the behavior under Windows (e.g. tell = 7), at least under Python 3, so there shall be a reason... |
I have still no real idea why this happens. It does not happen under Windows in Python 2, but happens in Python 3 (same as flush on reading, probably related). I happens only if |
Reopen as the fix broke other things. |
import pyfakefs.fake_filesystem
import os
fs = pyfakefs.fake_filesystem.FakeFilesystem()
fs.CreateDirectory('/Volumes')
fs.CreateDirectory('/Volumes/ramdisk')
fs.CreateDirectory('/Volumes/ramdisk/test')
os0 = pyfakefs.fake_filesystem.FakeOsModule(fs)
opener0 = pyfakefs.fake_filesystem.FakeFileOpen(fs)
component0 = "alpha"
path0 = "/Volumes/ramdisk/test"
path0 += "/" + component0
bytes0 = 0
bytes0 += 1
str0 = ""
str0 += 'a'
str0 += 'a'
str0 += 'a'
str0 += 'a'
str0 += 'a'
str0 += 'a'
file0 = opener0(path0,'w')
file1 = opener0(path0,'a')
file1.write(str0)
file0.seek(bytes0)
file0.truncate()
result = file1.tell()
print result
os 7 vs. pyfakefs 6
The text was updated successfully, but these errors were encountered: