[issue14715] test.support.DirsOnSysPath should be replaced by importlib.test.util.import_state

Brett Cannon report at bugs.python.org
Fri May 18 18:50:24 CEST 2012


Brett Cannon <brett at python.org> added the comment:

I see three options (which can be combined). One is to keep using something like the uncache context manager to make sure the expected modules get removed. Two is to check the keys of sys.modules at the end of a context manager and if there are new keys either blindly clean up or raise an error/warning that stuff was left behind. Lastly is to leave all built-in modules (and maybe extension modules if you are worried they will do something silly during init) in sys.modules and then clear out the rest (although that might screw up importlib if we end up hiding importlib._bootstrap behind _frozen_importlib, in which case you will want to leave frozen modules as well or special-case _frozen_importlib).

----------

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


More information about the Python-bugs-list mailing list