[issue26467] Add async magic method support to unittest.mock.Mock

2017-05-14 Thread Michał Bultrowicz
Michał Bultrowicz added the comment: I guess that it's worth noting that the same problem is being talked about in an issue on the asynctest library: https://github.com/Martiusweb/asynctest/issues/29 -- nosy: +butla ___ Python tracker <

[issue28733] Show how to use mock_open in modules other that __main__

2016-12-01 Thread Michał Bultrowicz
Michał Bultrowicz added the comment: One more update - I had the problem, because I was using monkeypatch.setattr() from Pytest, and assumed that it will work the same as patch(). This assumption turned out to be wrong. -- ___ Python tracker <

[issue28733] Show how to use mock_open in modules other that __main__

2016-11-30 Thread Michał Bultrowicz
Changes by Michał Bultrowicz <michal.bultrow...@gmail.com>: -- status: open -> closed ___ Python tracker <rep...@bugs.python.org> <http://bugs.pyt

[issue28733] Show how to use mock_open in modules other that __main__

2016-11-30 Thread Michał Bultrowicz
Michał Bultrowicz added the comment: Ok, I've checked again and now patching "file_writer.open" works. I have no idea what I was doing wrong the last time I checked... So I guess I'll close the issue. -- ___ Python tracker <rep...@bu

[issue28733] Show how to use mock_open in modules other that __main__

2016-11-29 Thread Michał Bultrowicz
Michał Bultrowicz added the comment: Then where it should be patched in? Can you give an example? From what I've checked patching only works in __main__ and builtins. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue28733] Show how to use mock_open in modules other that __main__

2016-11-18 Thread Michał Bultrowicz
New submission from Michał Bultrowicz: Documentation of mock_open doesn't say how to use it in real-life test situations (when you're probably not mocking in __main__). I've spent some time scratching my head and googling for the way to mock-out the "open" function, want to spare ot