Author rbcollins
Recipients rbcollins, yolanda.robla
Date 2016-04-25.15:42:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1461598963.38.0.258648874632.issue26807@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-04-25 15:42:43rbcollinssetrecipients: + rbcollins, yolanda.robla
2016-04-25 15:42:43rbcollinssetmessageid: <1461598963.38.0.258648874632.issue26807@psf.upfronthosting.co.za>
2016-04-25 15:42:43rbcollinslinkissue26807 messages
2016-04-25 15:42:43rbcollinscreate