New submission from Niv Ben-David:
The unittest.mock module defines a mock_open utility to mock the builtin open
function.
During a recent project I found I needed something more. Specifically, mocking
different files at the same time, better mocking for operations (like seek,
readlines, etc
Niv Ben-David added the comment:
Regarding the documentation changes, my version simply mocks `open` more
"closely", so for the most part I can't think of any changes to the
documentation. I've added a bit about the mock object acting as a map of file
names to mock o
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