Robert Collins added the comment: Thanks Yolanda. I've touched up the test a little and run a full test run (make test) - sadly it fails: there is an explicit test that StopIteration gets raised if you set it as a side effect.
====================================================================== FAIL: test_mock_open_after_eof (unittest.test.testmock.testmock.MockTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/robertc/work/cpython-3.5.hg/Lib/unittest/test/testmock/test mock.py", line 1428, in test_mock_open_after_eof self.assertEqual('', h.readline()) AssertionError: '' != None ====================================================================== FAIL: test_side_effect_iterator (unittest.test.testmock.testmock.MockTest ) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/robertc/work/cpython-3.5.hg/Lib/unittest/test/testmock/test mock.py", line 980, in test_side_effect_iterator self.assertRaises(StopIteration, mock) AssertionError: StopIteration not raised by <Mock id='140302027307384'> ====================================================================== FAIL: test_side_effect_setting_iterator (unittest.test.testmock.testmock. MockTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/robertc/work/cpython-3.5.hg/Lib/unittest/test/testmock/test mock.py", line 1015, in test_side_effect_setting_iterator self.assertRaises(StopIteration, mock) AssertionError: StopIteration not raised by <Mock id='140302027307720'> ---------------------------------------------------------------------- Ran 705 tests in 1.251s FAILED (failures=3, skipped=3) Of those, I think the first failure is a bug in the patch; the second and third are genuine failures - you'll need to make your change in mock_open itself, not in 'mock'. I've attached an updated patch which has ACKS, NEWS filled out and tweaked your test to be more comprehensive. ---------- keywords: +patch Added file: http://bugs.python.org/file42590/issue26807.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26807> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com