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 <rep...@bugs.python.org>
<http://bugs.python.org/issue15111>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to