Message219567
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
$ |
|
Date |
User |
Action |
Args |
2014-06-02 10:49:55 | kakuma | set | recipients:
+ kakuma, michael.foord |
2014-06-02 10:49:55 | kakuma | set | messageid: <1401706195.44.0.298195969951.issue21600@psf.upfronthosting.co.za> |
2014-06-02 10:49:55 | kakuma | link | issue21600 messages |
2014-06-02 10:49:55 | kakuma | create | |
|