Issue 28848: Add CopyingMock to mock.py (original) (raw)

Issue28848

Created on 2016-12-01 05:43 by wim.glenn, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
copying_mock.diff wim.glenn,2016-12-01 05:59 example impl review
Messages (4)
msg282136 - (view) Author: wim glenn (wim.glenn) * Date: 2016-12-01 05:43
Would people be interested to consider adding the CopyingMock example shown in the documentation section "coping with mutable arguments" into the mock module? https://docs.python.org/3/library/unittest.mock-examples.html#coping-with-mutable-arguments It seems like a useful and simple enough feature to add.
msg282137 - (view) Author: wim glenn (wim.glenn) * Date: 2016-12-01 05:59
Here's a first attempt at a patch. If it doesn't go into Lib finally, I'll just put up a CopyingMock on pypi instead. But it seemed like the kind of feature which should just be in mock directly rather than 3rd party, preferably.
msg284770 - (view) Author: wim glenn (wim.glenn) * Date: 2017-01-05 21:10
Guess there was no interest in this. I've released it on pypi instead (pip install copyingmock). https://github.com/wimglenn/copyingmock
msg284790 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2017-01-06 00:24
Thanks for releasing it on PyPI! It's probably better to keep it as an example in the documentation for now. We can reopen this if there's a demand for CopyingMock in the future.
History
Date User Action Args
2022-04-11 14:58:40 admin set github: 73034
2017-01-06 00:24:30 berker.peksag set status: open -> closedtype: enhancementnosy: + berker.peksagmessages: + resolution: rejectedstage: resolved
2017-01-05 21:10:02 wim.glenn set messages: +
2016-12-01 05:59:15 wim.glenn set files: + copying_mock.diffkeywords: + patchmessages: +
2016-12-01 05:43:38 wim.glenn create