Issue 17467: Enhancement: give mock_open readline() and readlines() methods (original) (raw)

Issue17467

Created on 2013-03-18 20:09 by a.badger, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python3-mock_open-methods.patch a.badger,2013-03-18 20:09 Patch mock_open to understand readline and readlines methods
01000-mock_open-methods.patch a.badger,2013-03-19 16:46 2nd version of mock_open readline/readlines patch
01000-mock_open-methods.patch a.badger,2013-03-19 19:17 3rd version of the mock_open patch -- docs and read/readline/readlines draw from the same read_data
Pull Requests
URL Status Linked Edit
PR 11523 merged remi.lapeyre,2019-01-11 17:00
PR 11523 merged remi.lapeyre,2019-01-11 17:00
PR 11523 merged remi.lapeyre,2019-01-11 17:00
Messages (4)
msg184512 - (view) Author: Toshio Kuratomi (a.badger) * Date: 2013-03-18 20:09
unittest.mock provides a mock_open convenience function[1]. The convenience function handled file.read() but does not handle file.readline() or file.readlines(). I'll attach a patch that adds support for both of these methods. [1]: http://docs.python.org/3/library/unittest.mock.html#mock-open
msg184642 - (view) Author: Toshio Kuratomi (a.badger) * Date: 2013-03-19 16:46
Updated patch that includes unittests and fixes readlines() newline behaviour.
msg184664 - (view) Author: Toshio Kuratomi (a.badger) * Date: 2013-03-19 19:17
3rd version of the patch. * Added some documentation to untitest.mock.rst * Changed the code so that read, readline, and readlines all deplete the same copy of read_data.
msg184714 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-03-20 00:22
New changeset 684b75600fa9 by Michael Foord in branch 'default': Closes issue 17467. Add readline and readlines support to unittest.mock.mock_open http://hg.python.org/cpython/rev/684b75600fa9
History
Date User Action Args
2022-04-11 14:57:43 admin set github: 61669
2019-01-11 17:00:56 remi.lapeyre set pull_requests: + <pull%5Frequest11103>
2019-01-11 17:00:48 remi.lapeyre set pull_requests: + <pull%5Frequest11102>
2019-01-11 17:00:41 remi.lapeyre set pull_requests: + <pull%5Frequest11101>
2014-12-07 15:25:59 jcea link issue23004 dependencies
2014-12-07 15:25:42 jcea set superseder: mock_open() should allow reading binary data
2013-03-20 00:22:57 python-dev set status: open -> closednosy: + python-devmessages: + resolution: fixedstage: patch review -> resolved
2013-03-19 19:17:32 a.badger set files: + 01000-mock_open-methods.patchmessages: +
2013-03-19 17:00:45 michael.foord set nosy: + michael.foordversions: + Python 3.4, - Python 3.3assignee: michael.foordkeywords: + needs reviewtype: enhancementstage: patch review
2013-03-19 16:46:50 a.badger set files: + 01000-mock_open-methods.patchmessages: +
2013-03-18 20:09:13 a.badger create