Martin Panter added the comment:

You should probably use try / finally in your context manager to always restore 
the attribute. Having said that, I recently wrote a similar context manager, 
and then later discovered there is already “unittest.mock.patch” and/or 
“unittest.mock.patch.object” via Issue 11664, which apparently can do this job.

----------
nosy: +vadmium

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22374>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to