summaryrefslogtreecommitdiff
path: root/Lib/test/test_pkgutil.py
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2014-05-23 12:32:30 -0400
committerBrett Cannon <brett@python.org>2014-05-23 12:32:30 -0400
commit17f9cc07f3fcb15ca3afde0643edd0b43b5bda8e (patch)
treec37270f2d135305522e1ddfe01971bbdaf0ecd61 /Lib/test/test_pkgutil.py
parentc083537b8731c8f2ffe607a12f96a3eb95f788f7 (diff)
parent8447c703d1fd0107a52b15de7ce3a7056e1ec160 (diff)
downloadcpython-git-17f9cc07f3fcb15ca3afde0643edd0b43b5bda8e.tar.gz
Merge for issue #14710
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 9704156a52..e0c8635de1 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"))