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 martin.panter
Recipients docs@python, martin.panter, ncoghlan, terry.reedy
Date 2014-09-10.07:21:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1410333713.51.0.736097908905.issue22374@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-09-10 07:21:53martin.pantersetrecipients: + martin.panter, terry.reedy, ncoghlan, docs@python
2014-09-10 07:21:53martin.pantersetmessageid: <1410333713.51.0.736097908905.issue22374@psf.upfronthosting.co.za>
2014-09-10 07:21:53martin.panterlinkissue22374 messages
2014-09-10 07:21:53martin.pantercreate