summaryrefslogtreecommitdiff
path: root/Lib/unittest/mock.py
diff options
context:
space:
mode:
authorRobert Collins <rbtcollins@hp.com>2016-05-16 15:22:01 +1200
committerRobert Collins <rbtcollins@hp.com>2016-05-16 15:22:01 +1200
commit9549a3e3d4be2a15c222996abff8cb97180ee9be (patch)
tree6459b7352282cce393976499fa5830aa14b9d96c /Lib/unittest/mock.py
parent33a8fb9920efc4e4f8c6afa1062c966b27f222a9 (diff)
downloadcpython-git-9549a3e3d4be2a15c222996abff8cb97180ee9be.tar.gz
Issue #26807: mock_open 'files' no longer error on readline at end of file.
Patch from Yolanda Robla.
Diffstat (limited to 'Lib/unittest/mock.py')
-rw-r--r--Lib/unittest/mock.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py
index cabae15214..86a5a3dfeb 100644
--- a/Lib/unittest/mock.py
+++ b/Lib/unittest/mock.py
@@ -2323,6 +2323,8 @@ def mock_open(mock=None, read_data=''):
yield handle.readline.return_value
for line in _state[0]:
yield line
+ while True:
+ yield type(read_data)()
global file_spec