diff options
Diffstat (limited to 'Lib/test/test_importlib')
-rw-r--r-- | Lib/test/test_importlib/import_/test_api.py | 4 | ||||
-rw-r--r-- | Lib/test/test_importlib/import_/test_fromlist.py | 8 |
2 files changed, 4 insertions, 8 deletions
diff --git a/Lib/test/test_importlib/import_/test_api.py b/Lib/test/test_importlib/import_/test_api.py index 52a3190..bf74937 100644 --- a/Lib/test/test_importlib/import_/test_api.py +++ b/Lib/test/test_importlib/import_/test_api.py @@ -22,10 +22,6 @@ class APITest(unittest.TestCase): """Test API-specific details for __import__ (e.g. raising the right exception when passing in an int for the module name).""" - def test_raises_ModuleNotFoundError(self): - with self.assertRaises(ModuleNotFoundError): - util.import_('some module that does not exist') - def test_name_requires_rparition(self): # Raise TypeError if a non-string is passed in for the module name. with self.assertRaises(TypeError): diff --git a/Lib/test/test_importlib/import_/test_fromlist.py b/Lib/test/test_importlib/import_/test_fromlist.py index a31d216..e440566 100644 --- a/Lib/test/test_importlib/import_/test_fromlist.py +++ b/Lib/test/test_importlib/import_/test_fromlist.py @@ -68,16 +68,16 @@ class HandlingFromlist(unittest.TestCase): self.assertTrue(hasattr(module, 'module')) self.assertEqual(module.module.__name__, 'pkg.module') - def test_module_from_package_triggers_ModuleNotFoundError(self): - # If a submodule causes an ModuleNotFoundError because it tries to import - # a module which doesn't exist, that should let the ModuleNotFoundError + def test_module_from_package_triggers_ImportError(self): + # If a submodule causes an ImportError because it tries to import + # a module which doesn't exist, that should let the ImportError # propagate. def module_code(): import i_do_not_exist with util.mock_modules('pkg.__init__', 'pkg.mod', module_code={'pkg.mod': module_code}) as importer: with util.import_state(meta_path=[importer]): - with self.assertRaises(ModuleNotFoundError) as exc: + with self.assertRaises(ImportError) as exc: import_util.import_('pkg', fromlist=['mod']) self.assertEqual('i_do_not_exist', exc.exception.name) |