[issue18622] reset_mock on mock created by mock_open causes infinite recursion

2014-01-14 Thread Laurent De Buyst
Laurent De Buyst added the comment: Sorry Michael, I should have read your second comment more closely since you already pointed out that using a list as default argument is bad. It is, however, easily fixed by changing to this: def reset_mock(self, visited=None): Restore the mock object

[issue18622] reset_mock on mock created by mock_open causes infinite recursion

2014-01-14 Thread Laurent De Buyst
Laurent De Buyst added the comment: And here's an actual patch with the corrected code -- Added file: http://bugs.python.org/file33463/issue18622_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18622

[issue18622] reset_mock on mock created by mock_open causes infinite recursion

2014-01-13 Thread Laurent De Buyst
Laurent De Buyst added the comment: The proposed patch does solve the infinite recursion bug, but a different problem appears when resetting the same mock multiple times: it only works the first time. Using the patch as it stands: from unittest.mock import mock_open mo = mock_open