mirror of
https://github.com/python/cpython.git
synced 2025-11-09 10:01:42 +00:00
bpo-30436: Raise ModuleNotFoundError for importlib.util.find_spec() when parent isn't a package (GH-1899)
Previously AttributeError was raised, but that's not very reflective of the fact that the requested module can't be found since the specified parent isn't actually a package.
This commit is contained in:
parent
32fd874afe
commit
8c3f05e9f0
5 changed files with 24 additions and 4 deletions
|
|
@ -427,7 +427,7 @@ def test_dash_m_errors(self):
|
|||
tests = (
|
||||
('builtins', br'No code object available'),
|
||||
('builtins.x', br'Error while finding module specification.*'
|
||||
br'AttributeError'),
|
||||
br'ModuleNotFoundError'),
|
||||
('builtins.x.y', br'Error while finding module specification.*'
|
||||
br'ModuleNotFoundError.*No module named.*not a package'),
|
||||
('os.path', br'loader.*cannot handle'),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue