[issue21750] mock_open data is visible only once for the life of the class

Robert Collins report at bugs.python.org
Tue Jul 21 21:20:28 CEST 2015


Robert Collins added the comment:

But - its worth discussing. Perhaps we should roll this all back, and just say 'use a vfs layer for tests like this'. The problem in doing that, is that the
@patch
def test_foo...

use case is actually pretty common IME, and this conflicts with the 
@patch
...
A = open()
B = open()
A.read()
B.read()

case where the reset in the open() side effect will cause B.read to end up returning ''.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21750>
_______________________________________


More information about the Python-bugs-list mailing list