[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2018-07-20 Thread Antoni Szych
Antoni Szych added the comment: Hi, Any chance of getting this resolved 1 year later? :) BR -- ___ Python tracker ___ ___ Python-

[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2017-07-12 Thread Antoni Szych
Antoni Szych added the comment: Hi, It's been 3 years now since this issue was first raised. We bumped upon this issue while using code like following: def tearDown(): patch.stopall() def test123(): p=patch.dict(...) p.start() assert False p.stop() While `patch.stopall()`

[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2014-12-11 Thread Eric Snow
Eric Snow added the comment: Ah. Never mind then. :) -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:

[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2014-12-11 Thread Michael Foord
Michael Foord added the comment: Using patch.dict manipulates the contents of sys.modules, it doesn't replace sys.modules. -- ___ Python tracker ___

[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2014-12-10 Thread Eric Snow
Eric Snow added the comment: At least for CPython sys.modules is initially set to the modules dict on the interpreter struct. As of 3.4 the import system itself only cares about sys.modules (I'll have to double check on builtin___import__). However, if I recall correctly at least part of the

[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2014-12-10 Thread Colton Leekley-Winslow
Colton Leekley-Winslow added the comment: Patching sys.modules is an idea I got from the official documentation https://docs.python.org/3/library/unittest.mock.html#patch-dict http://mock.readthedocs.org/en/latest/patch.html#patch-dict -- ___ Pytho

[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2014-12-10 Thread Michael Foord
Michael Foord added the comment: why not? -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pytho

[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2014-12-09 Thread Eric Snow
Eric Snow added the comment: FYI, you probably don't want to be patching out sys.modules. It isn't guaranteed that doing so will have the expected effect on import semantics. -- nosy: +eric.snow ___ Python tracker

[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2014-10-14 Thread Kushal Das
Kushal Das added the comment: I will do that. New job is taking time. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsu

[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2014-10-14 Thread Michael Foord
Michael Foord added the comment: It just needs committing, I believe Kushal Das has volunteered to do it. -- ___ Python tracker ___ __

[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2014-10-14 Thread Colton Leekley-Winslow
Colton Leekley-Winslow added the comment: What's the status on this? -- nosy: +lwcolton ___ Python tracker ___ ___ Python-bugs-list ma

[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2014-06-08 Thread fumihiko kakuma
fumihiko kakuma added the comment: Thank you in advance. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2014-06-08 Thread Michael Foord
Michael Foord added the comment: That looks great - thanks! I'll get it committed shortly. -- ___ Python tracker ___ ___ Python-bugs-l

[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2014-06-07 Thread fumihiko kakuma
fumihiko kakuma added the comment: Hi michael, Certainly, thank you for your many advices. I attached the new patch file. -- Added file: http://bugs.python.org/file35513/support_patch_dict_by_stopall.diff ___ Python tracker

[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2014-06-06 Thread Michael Foord
Michael Foord added the comment: That's better - thanks. Another minor tweak needed though. stopall should only stop patches that were started with "start", not those used as context managers or decorators (or they will be stopped twice!). See how the main patch object only adds to the set of

[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2014-06-06 Thread fumihiko kakuma
fumihiko kakuma added the comment: Thank you for your reply. Yes, you are right. The patch was too slapdash. I re-created it and added unit tests. -- Added file: http://bugs.python.org/file35499/support_patch_dict_by_stopall.diff ___ Python tracker

[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2014-06-03 Thread Michael Foord
Michael Foord added the comment: Yep, patch.dict wasn't designed with stopall in mind so it needs adding. Thanks for pointing this out and your fix. Your patch isn't quite right, those operations shouldn't be inside the try excepts. (And there are no tests.) -- assignee: -> michael.

[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2014-06-03 Thread R. David Murray
Changes by R. David Murray : -- nosy: +kushal.das ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2014-06-02 Thread fumihiko kakuma
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

[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2014-05-29 Thread Ned Deily
Changes by Ned Deily : -- nosy: +michael.foord ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyt

[issue21600] mock.patch.stopall doesn't work with patch.dict to sys.modules

2014-05-28 Thread fumihiko kakuma
New submission from fumihiko kakuma: It seems that stopall doesn't work when do start patch.dict to sys.modules. I show sample scripts the following. Using stopall test case seems to always refer the first mock foo object. But using stop it refers a new mock foo object. $ cat test_sampmod.py im