[issue25690] Replacement for unittest.mock.mock_open

2016-03-15 Thread Niv Ben-David
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 y

[issue25690] Replacement for unittest.mock.mock_open

2016-03-13 Thread Robert Collins
Robert Collins added the comment: Hmm, I haven't looked closely, but some high level thoughts. I'm worried about making mock too complex here. We already say folk should use a VFS for complex file based tests, and there's quite a chunk of code you're adding - perhaps better to just use a VFS?

[issue25690] Replacement for unittest.mock.mock_open

2016-01-30 Thread Niv Ben-David
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 anythi

[issue25690] Replacement for unittest.mock.mock_open

2015-11-21 Thread R. David Murray
R. David Murray added the comment: Thanks for the submission. I haven't looked at this in detail, but the fact that you are changing existing unit tests indicates there is probably a backward compatibility problem with your patch. Also if you are adding features I'd expect there to be doc cha

[issue25690] Replacement for unittest.mock.mock_open

2015-11-21 Thread SilentGhost
Changes by SilentGhost : -- components: +Tests nosy: +ezio.melotti, michael.foord, rbcollins stage: -> patch review ___ Python tracker ___ __

[issue25690] Replacement for unittest.mock.mock_open

2015-11-21 Thread Niv Ben-David
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.