summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_imp.py
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-05-03 14:47:17 (GMT)
committerBrett Cannon <brett@python.org>2013-05-03 14:47:17 (GMT)
commit2a9c653f38b1107017cb6e71a6223a3e4870eb68 (patch)
tree315a4494976a8883a241ea991931b33911472ebe /Lib/test/test_imp.py
parent4072875dcbdd60d27ec406eb3abe74f41c1be158 (diff)
parent9d0f772c5115217d55aef76fae33f483f2a98032 (diff)
downloadcpython-2a9c653f38b1107017cb6e71a6223a3e4870eb68.zip
cpython-2a9c653f38b1107017cb6e71a6223a3e4870eb68.tar.gz
cpython-2a9c653f38b1107017cb6e71a6223a3e4870eb68.tar.bz2
#15902: merge w/ 3.3
Diffstat (limited to 'Lib/test/test_imp.py')
-rw-r--r--Lib/test/test_imp.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py
index 2d75724..74a7b59 100644
--- a/Lib/test/test_imp.py
+++ b/Lib/test/test_imp.py
@@ -208,6 +208,8 @@ class ImportTests(unittest.TestCase):
self.assertIsNot(orig_getenv, new_os.getenv)
@support.cpython_only
+ @unittest.skipIf(not hasattr(imp, 'load_dynamic'),
+ 'imp.load_dynamic() required')
def test_issue15828_load_extensions(self):
# Issue 15828 picked up that the adapter between the old imp API
# and importlib couldn't handle C extensions
@@ -244,6 +246,19 @@ class ImportTests(unittest.TestCase):
self.assertIn(path, err.exception.path)
self.assertEqual(name, err.exception.name)
+ @support.cpython_only
+ @unittest.skipIf(not hasattr(imp, 'load_dynamic'),
+ 'imp.load_dynamic() required')
+ def test_load_module_extension_file_is_None(self):
+ # When loading an extension module and the file is None, open one
+ # on the behalf of imp.load_dynamic().
+ # Issue #15902
+ name = '_heapq'
+ found = imp.find_module(name)
+ assert found[2][2] == imp.C_EXTENSION
+ found[0].close()
+ imp.load_module(name, None, *found[1:])
+
class ReloadTests(unittest.TestCase):