summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pkgutil.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_pkgutil.py')
-rw-r--r--Lib/test/test_pkgutil.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_pkgutil.py b/Lib/test/test_pkgutil.py
index 9704156..e0c8635de 100644
--- a/Lib/test/test_pkgutil.py
+++ b/Lib/test/test_pkgutil.py
@@ -363,6 +363,20 @@ class ImportlibMigrationTests(unittest.TestCase):
loader = pkgutil.get_loader(name)
self.assertIsNone(loader)
+ def test_get_loader_None_in_sys_modules(self):
+ name = 'totally bogus'
+ sys.modules[name] = None
+ try:
+ loader = pkgutil.get_loader(name)
+ finally:
+ del sys.modules[name]
+ self.assertIsNone(loader)
+
+ def test_find_loader_missing_module(self):
+ name = 'totally bogus'
+ loader = pkgutil.find_loader(name)
+ self.assertIsNone(loader)
+
def test_find_loader_avoids_emulation(self):
with check_warnings() as w:
self.assertIsNotNone(pkgutil.find_loader("sys"))