Issue #14285: Do not catch exceptions initializing any ancestor package

The previous fix only handled the case of the parent package of __main__
failing to initialize.

Also make the "Error while finding spec" formatting slightly more appealing,
and document and test that the module name must be absolute.
This commit is contained in:
Martin Panter 2015-12-10 06:47:06 +00:00
parent a29eb08fb9
commit 7dda421bff
5 changed files with 31 additions and 6 deletions

View file

@ -433,6 +433,7 @@ class CmdLineTest(unittest.TestCase):
('importlib', br'No module named.*'
br'is a package and cannot be directly executed'),
('importlib.nonexistant', br'No module named'),
('.unittest', br'Relative module names not supported'),
)
for name, regex in tests:
with self.subTest(name):