Georg Sauthoff added the comment: For working around this issue on Python 3.5 it is sufficient to overwrite just the `return_value.__iter__` method of the object returned by `mock_open()` with an iterator that calls the mocked `readline()` method until it returns the empty string.
cf. e.g. https://github.com/gsauthof/utility/blob/6489c7215dac341be4e40e5348e64d69461766dd/user-installed.py#L176-L179 This also works in combination with `csv.reader()`, i.e. when calling it with the mocked file object. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21258> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com