This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rbcollins
Recipients berker.peksag, michael.foord, pkoning, python-dev, quasipedia, rbcollins
Date 2015-07-21.20:18:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1437509916.83.0.171143728912.issue21750@psf.upfronthosting.co.za>
In-reply-to
Content
@pkoning in Python3.3 == mock 1.0.1, 
>>> m = mock_open(read_data='f')
>>> m().read()
'f'
>>> m().read()
'f'
>>> x = m()
>>> x.read()
'f'
>>> x.read()
'f'
>>> x = m()
>>> y = m()
>>> x.read()
'f'
>>> y.read()
'f'

in 3.4 == mock 1.1.{0,1,2,3}, and 1.2.0
>>> m = mock_open(read_data='f')
>>> m().read()
'f'
>>> m().read()
''
>>> x = m()
>>> x.read()
''
>>> x.read()
''
>>> x = m()
>>> y = m()
>>> x.read()
'f'
>>> y.read()
''

Right now, in 3.5==mock 1.1.4
>>> m = mock_open(read_data='f')
>>> m().read()
'f'
>>> m().read()
'f'
>>> x = m()
>>> x.read()
'f'
>>> x.read()
''
>>> x = m()
>>> y = m()
>>> x.read()
'f'
>>> y.read()
'f'


With the patch I just attached:
>>> m = mock_open(read_data='f')
>>> m().read()
'f'
>>> m().read()
'f'
>>> x = m()
>>> x.read()
'f'
>>> x.read()
''
>>> x = m()
>>> y = m()
>>> x.read()
'f'
>>> y.read()
''

All different points in the solution space :)
HTH
History
Date User Action Args
2015-07-21 20:18:36rbcollinssetrecipients: + rbcollins, michael.foord, python-dev, quasipedia, berker.peksag, pkoning
2015-07-21 20:18:36rbcollinssetmessageid: <1437509916.83.0.171143728912.issue21750@psf.upfronthosting.co.za>
2015-07-21 20:18:36rbcollinslinkissue21750 messages
2015-07-21 20:18:36rbcollinscreate