fumihiko kakuma added the comment:

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
$

----------
keywords: +patch
Added file: http://bugs.python.org/file35445/add_stopall_patch_dict.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21600>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to