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.

Author kakuma
Recipients kakuma, michael.foord
Date 2014-06-02.10:49:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1401706195.44.0.298195969951.issue21600@psf.upfronthosting.co.za>
In-reply-to
Content
Checking mock.py(version 1.0.1) it seems that patch.stopall does not support patch.dict. Does it have any problem to support ptch.dict by stopall.
I made the attached patch file for this. It seems to work well. How about this?

But I don't know why sys.modules refers the first mock object. 

$ python test_samp.py
test_samp1 (__main__.SampTestCase) ... foo_mod=<Mock id='140164117280080'>
myfunc foo=<Mock id='140164117280080'>
>>> stopall patch
ok
test_samp2 (__main__.SampTestCase) ... foo_mod=<Mock id='140164117280208'>
myfunc foo=<Mock id='140164117280208'>
>>> stopall patch
ok
test_samp3 (__main__.SampTestCase) ... foo_mod=<Mock id='140164117280464'>
myfunc foo=<Mock id='140164117280464'>
>>> stopall patch
ok

----------------------------------------------------------------------
Ran 3 tests in 0.001s

OK
$
History
Date User Action Args
2014-06-02 10:49:55kakumasetrecipients: + kakuma, michael.foord
2014-06-02 10:49:55kakumasetmessageid: <1401706195.44.0.298195969951.issue21600@psf.upfronthosting.co.za>
2014-06-02 10:49:55kakumalinkissue21600 messages
2014-06-02 10:49:55kakumacreate