Niv Ben-David added the comment: I copied the code in place of the old mock_open in unittest/mock.py.
Regarding the VFS issue, I think that it really depends on what you're trying to test. If you only care about "side effects" on the file system, the VFS way it much better and easier. But if you want to test the way files are handled by your code (proper handling of errors during open/read/write seems the obvious thing here, but I can think of other use cases), then I think MockOpen is the better tool. ---------- Added file: http://bugs.python.org/file42175/mock_open.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25690> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com