Issue 21271: reset_mock needs parameters to also reset return_value and side_effect (original) (raw)

Created on 2014-04-16 20:51 by michael.foord, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue21271.patch kushal.das,2015-04-14 13:58 New parameters for reset_mock review
issue21271v2.patch kushal.das,2015-04-14 15:25 Version 2 of the patch review
Messages (7)
msg216588 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2014-04-16 20:51
unittest.mock.Mock.reset_mock deliberately doesn't reset the return_value and side_effect. It would be nice if it gained parameters so that it *could*.
msg240585 - (view) Author: Kushal Das (kushal.das) * (Python committer) Date: 2015-04-13 02:25
Working on it. Will submit the patch tomorrow.
msg240888 - (view) Author: Kushal Das (kushal.das) * (Python committer) Date: 2015-04-14 13:58
A patch without NEWS and whatsnew update. I will fill them before commit. The reset_mock function now has two parameters, return_value, and side_effect. Passing True value to any of these will reset that attribute.
msg240890 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2015-04-14 14:12
I left a couple of comments of Rietveld.
msg240906 - (view) Author: Kushal Das (kushal.das) * (Python committer) Date: 2015-04-14 15:25
Updated patch with the suggestions from Berker.
msg266895 - (view) Author: Kushal Das (kushal.das) * (Python committer) Date: 2016-06-02 17:23
Fixed in https://hg.python.org/cpython/rev/b110dd3d6cea
msg266896 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-06-02 17:29
New changeset b110dd3d6cea by Kushal Das in branch 'default': Issue #21271: Adds new keyword only parameters in reset_mock call https://hg.python.org/cpython/rev/b110dd3d6cea
History
Date User Action Args
2022-04-11 14:58:02 admin set github: 65470
2016-06-02 17:29:18 python-dev set nosy: + python-devmessages: +
2016-06-02 17:26:50 abarry set resolution: fixedstage: patch review -> resolved
2016-06-02 17:23:44 kushal.das set status: open -> closedmessages: +
2015-04-14 15:25:25 kushal.das set files: + issue21271v2.patchmessages: +
2015-04-14 14:12:08 berker.peksag set nosy: + berker.peksagmessages: + type: behavior -> enhancementstage: needs patch -> patch review
2015-04-14 13:58:03 kushal.das set files: + issue21271.patchkeywords: + patchmessages: +
2015-04-13 02:25:17 kushal.das set messages: +
2015-03-09 14:40:57 Claudiu.Popa set nosy: + Claudiu.Popa
2014-04-16 20:51:44 michael.foord create