[issue15111] Wrong ImportError message with importlib
Brett Cannon
report at bugs.python.org
Wed Oct 10 15:28:04 CEST 2012
Brett Cannon added the comment:
Here are two possible tests.
1) __import__('distutils', fromlist=['_i_do_not_exist']) should return distutils
2) Use a fake loader which executes some code which does nothing more than tries to import a non-existent module. The trick with this test is that the submodule must be found but a module that the submodule needs cannot be found by import itself (and simply not faked with an ImportError thanks to the _not_found hack and needing that attribute to propagate up to the submodule search).
And I think the failure stems from the lack of check against exc.name equaling the name of the module being imported (e.g. exc.name == distutils.msvc9compiler) since the winreg import is a failed module search as well.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15111>
_______________________________________
More information about the Python-bugs-list
mailing list