Message226686
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. |
|
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 | |
|