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.

classification
Title: Add CopyingMock to mock.py
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.7
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: berker.peksag, wim.glenn
Priority: normal Keywords: patch

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:40adminsetgithub: 73034
2017-01-06 00:24:30berker.peksagsetstatus: open -> closed

type: enhancement

nosy: + berker.peksag
messages: + msg284790
resolution: rejected
stage: resolved
2017-01-05 21:10:02wim.glennsetmessages: + msg284770
2016-12-01 05:59:15wim.glennsetfiles: + copying_mock.diff
keywords: + patch
messages: + msg282137
2016-12-01 05:43:38wim.glenncreate