Michael Foord added the comment: Using patch.dict manipulates the contents of sys.modules, it doesn't replace sys.modules. ---------- _______________________________________ Python tracker <report at bugs.python.org> <http://bugs.python.org/issue21600> _______________________________________