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 objects. Should I add anything else?
Regarding the tests, I've tried changing as little as possible to make sure I don't have any backward compatibility issues. However, some changes had to be made: * By default, `open`'s mode is 'r', the new mock_open imitates this behavior, and so the test shows. Also, calling `open` as a context manager will call `close` in `__exit__`. These are the majority of changes to the testing code. * test_mock_open_write and test_mock_open_read_with_argument: These functionalities' testing is taken care of by the new mock_open tests. * test_readlines_data: I removed the `create` argument to `patch`. Must've been by accident. Fixed this in the new patch. Sorry about the (very) late response, I've been preoccupied lately. ---------- Added file: http://bugs.python.org/file41762/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