diff options
author | Brett Cannon <bcannon@gmail.com> | 2009-02-01 00:49:41 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2009-02-01 00:49:41 (GMT) |
commit | e70485e7c1e9f769679328ee87f9e61bbd892ed8 (patch) | |
tree | 339ffc3f79fa4346836f2d26482a9c73e08041ae /Lib/importlib | |
parent | d98a6a014d38ddf830695369f8d5dda98c4aba1a (diff) | |
download | cpython-e70485e7c1e9f769679328ee87f9e61bbd892ed8.zip cpython-e70485e7c1e9f769679328ee87f9e61bbd892ed8.tar.gz cpython-e70485e7c1e9f769679328ee87f9e61bbd892ed8.tar.bz2 |
Move extension module loader tests over to importlib.test.abc.LoaderTests.
Diffstat (limited to 'Lib/importlib')
-rw-r--r-- | Lib/importlib/NOTES | 1 | ||||
-rw-r--r-- | Lib/importlib/test/extension/test_loader.py | 25 |
2 files changed, 22 insertions, 4 deletions
diff --git a/Lib/importlib/NOTES b/Lib/importlib/NOTES index 51a6397..9d5fd69 100644 --- a/Lib/importlib/NOTES +++ b/Lib/importlib/NOTES @@ -4,7 +4,6 @@ to do * Use test.abc.LoaderTests + frozen - + extension + source * Reorganize support code. diff --git a/Lib/importlib/test/extension/test_loader.py b/Lib/importlib/test/extension/test_loader.py index 4f2a0d8..51d6161 100644 --- a/Lib/importlib/test/extension/test_loader.py +++ b/Lib/importlib/test/extension/test_loader.py @@ -1,12 +1,13 @@ import importlib from . import test_path_hook +from .. import abc from .. import support import sys import unittest -class LoaderTests(unittest.TestCase): +class LoaderTests(abc.LoaderTests): """Test load_module() for extension modules.""" @@ -16,7 +17,7 @@ class LoaderTests(unittest.TestCase): False) return loader.load_module(fullname) - def test_success(self): + def test_module(self): with support.uncache(test_path_hook.NAME): module = self.load_module(test_path_hook.NAME) for attr, value in [('__name__', test_path_hook.NAME), @@ -24,7 +25,25 @@ class LoaderTests(unittest.TestCase): self.assertEqual(getattr(module, attr), value) self.assert_(test_path_hook.NAME in sys.modules) - def test_failure(self): + def test_package(self): + # Extensions are not found in packages. + pass + + def test_lacking_parent(self): + # Extensions are not found in packages. + pass + + def test_module_reuse(self): + with support.uncache(test_path_hook.NAME): + module1 = self.load_module(test_path_hook.NAME) + module2 = self.load_module(test_path_hook.NAME) + self.assert_(module1 is module2) + + def test_state_after_failure(self): + # No easy way to trigger a failure after a successful import. + pass + + def test_unloadable(self): self.assertRaises(ImportError, self.load_module, 'asdfjkl;') |