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

Michael Foord report at bugs.python.org
Fri Jun 6 16:53:13 CEST 2014


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 active patches in the start method, not in __enter__ (and removes in stop rather than __exit__).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21600>
_______________________________________


More information about the Python-bugs-list mailing list