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
Describe the bug
Adding a file with add_real_file(file, read_only=False), then writing to the file, does not properly truncate the fake in-memory file – instead it appears to continue reading from the real file on disk.
I'm not sure if this is related to #277, but I can reproduce with much simpler test code.
Thanks - I will check this. And this is not related to #277 - that happens only under Python 2, and only on MacOS, while I could reproduce this one also under Windows.
Wow, thanks for the quick fix! For reference in case anyone else needs a temporary workaround, what I did in the meantime is pretty simple: you can just remove the file, then use create_file() to replace the contents and everything works as expected.
Describe the bug
Adding a file with
add_real_file(file, read_only=False)
, then writing to the file, does not properly truncate the fake in-memory file – instead it appears to continue reading from the real file on disk.I'm not sure if this is related to #277, but I can reproduce with much simpler test code.
How To Reproduce
Using pytest:
foo.txt
contents:Output:
Your enviroment
Using
pyenv
withpyfakefs
andpytest
installed in the "system" python provided bypyenv
.The text was updated successfully, but these errors were encountered: