python3-mock-open

Better mock for file I/O
  https://github.com/nivbend/mock-open
  0
  no reviews



The MockOpen class should work as a stand-in replacement for mock.mock_open with some added features (though it tries to conform to how the builtin 'open' works where the two differ).

Features include:

* Multiple file support, including a mapping-like access to file mocks by path. * Persistent file contents between calls to `open`. * All the regular file operations: 'read', 'readline', 'readlines', 'write', 'writelines', 'seek', 'tell'.