diff options
author | Brett Cannon <brett@python.org> | 2012-07-20 18:48:53 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2012-07-20 18:48:53 (GMT) |
commit | 45a5e3afe52ed89f298242143c5f7e2bb992ac63 (patch) | |
tree | 2255a23f991f1452335d865939f6c30d7b2d7d48 /Lib/importlib/test/extension/test_loader.py | |
parent | 4afc1c08d04a9c083b654178ea4f947563510836 (diff) | |
download | cpython-45a5e3afe52ed89f298242143c5f7e2bb992ac63.zip cpython-45a5e3afe52ed89f298242143c5f7e2bb992ac63.tar.gz cpython-45a5e3afe52ed89f298242143c5f7e2bb992ac63.tar.bz2 |
Issue #15168: Move importlb.test to test.test_importlib.
This should make the Linux distros happy as it is now easier to leave
importlib's tests out of their base Python distribution.
Diffstat (limited to 'Lib/importlib/test/extension/test_loader.py')
-rw-r--r-- | Lib/importlib/test/extension/test_loader.py | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/Lib/importlib/test/extension/test_loader.py b/Lib/importlib/test/extension/test_loader.py deleted file mode 100644 index 917843f..0000000 --- a/Lib/importlib/test/extension/test_loader.py +++ /dev/null @@ -1,71 +0,0 @@ -from importlib import machinery -from . import util as ext_util -from .. import abc -from .. import util - -import sys -import unittest - - -class LoaderTests(abc.LoaderTests): - - """Test load_module() for extension modules.""" - - def setUp(self): - self.loader = machinery.ExtensionFileLoader(ext_util.NAME, - ext_util.FILEPATH) - - def load_module(self, fullname): - return self.loader.load_module(fullname) - - def test_load_module_API(self): - # Test the default argument for load_module(). - self.loader.load_module() - self.loader.load_module(None) - with self.assertRaises(ImportError): - self.load_module('XXX') - - - def test_module(self): - with util.uncache(ext_util.NAME): - module = self.load_module(ext_util.NAME) - for attr, value in [('__name__', ext_util.NAME), - ('__file__', ext_util.FILEPATH), - ('__package__', '')]: - self.assertEqual(getattr(module, attr), value) - self.assertIn(ext_util.NAME, sys.modules) - self.assertIsInstance(module.__loader__, - machinery.ExtensionFileLoader) - - 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 util.uncache(ext_util.NAME): - module1 = self.load_module(ext_util.NAME) - module2 = self.load_module(ext_util.NAME) - self.assertIs(module1, module2) - - def test_state_after_failure(self): - # No easy way to trigger a failure after a successful import. - pass - - def test_unloadable(self): - name = 'asdfjkl;' - with self.assertRaises(ImportError) as cm: - self.load_module(name) - self.assertEqual(cm.exception.name, name) - - -def test_main(): - from test.support import run_unittest - run_unittest(LoaderTests) - - -if __name__ == '__main__': - test_main() |