Message226686
| 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:53 | martin.panter | set | recipients: + martin.panter, terry.reedy, ncoghlan, docs@python |
| 2014-09-10 07:21:53 | martin.panter | set | messageid: <1410333713.51.0.736097908905.issue22374@psf.upfronthosting.co.za> |
| 2014-09-10 07:21:53 | martin.panter | link | issue22374 messages |
| 2014-09-10 07:21:53 | martin.panter | create | |