Author pkoning
Recipients pkoning
Date 2014-06-13.18:14:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1402683289.16.0.550319898466.issue21750@psf.upfronthosting.co.za>
In-reply-to
Content
The read_data iterator that supplies bits of read data when asked from unittest.mock.mock_open is a class attribute.  The result is that, if you instantiate the class multiple times, that iterator is shared.  This isn't documented and it seems counterintuitive.  The purpose of mock_open is to act like a file, and read_data is that file's data.  A file contains the same data each time you read it.  So it would seem better for the data iterator to be an instance attribute, initialized from the mock_open read_data value each time mock_open is called to create a new file instance.
History
Date User Action Args
2014-06-13 18:14:49pkoningsetrecipients: + pkoning
2014-06-13 18:14:49pkoningsetmessageid: <1402683289.16.0.550319898466.issue21750@psf.upfronthosting.co.za>
2014-06-13 18:14:49pkoninglinkissue21750 messages
2014-06-13 18:14:48pkoningcreate