summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2009-02-01 00:37:13 (GMT)
committerBrett Cannon <bcannon@gmail.com>2009-02-01 00:37:13 (GMT)
commitd98a6a014d38ddf830695369f8d5dda98c4aba1a (patch)
tree00972bc7c20385e7c2df1c3be1ed14d92c49ac49 /Lib
parentfa6cf39e7095d4fba72d0364054512d17b9c3e60 (diff)
downloadcpython-d98a6a014d38ddf830695369f8d5dda98c4aba1a.zip
cpython-d98a6a014d38ddf830695369f8d5dda98c4aba1a.tar.gz
cpython-d98a6a014d38ddf830695369f8d5dda98c4aba1a.tar.bz2
Move built-in loader tests to importlib.test.abc.LoaderTests.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/importlib/NOTES3
-rw-r--r--Lib/importlib/test/builtin/test_loader.py26
2 files changed, 24 insertions, 5 deletions
diff --git a/Lib/importlib/NOTES b/Lib/importlib/NOTES
index 4c2e707..51a6397 100644
--- a/Lib/importlib/NOTES
+++ b/Lib/importlib/NOTES
@@ -1,9 +1,8 @@
to do
/////
-* Use test.loader_tests
+* Use test.abc.LoaderTests
- + builtin
+ frozen
+ extension
+ source
diff --git a/Lib/importlib/test/builtin/test_loader.py b/Lib/importlib/test/builtin/test_loader.py
index 87726c9..3de0526 100644
--- a/Lib/importlib/test/builtin/test_loader.py
+++ b/Lib/importlib/test/builtin/test_loader.py
@@ -1,5 +1,6 @@
import importlib
from importlib import machinery
+from .. import abc
from .. import support
import sys
@@ -7,7 +8,7 @@ import types
import unittest
-class LoaderTests(unittest.TestCase):
+class LoaderTests(abc.LoaderTests):
"""Test load_module() for built-in modules."""
@@ -26,13 +27,32 @@ class LoaderTests(unittest.TestCase):
load_module = staticmethod(lambda name:
machinery.BuiltinImporter.load_module(name))
- def test_load_module(self):
+ def test_module(self):
# Common case.
with support.uncache(self.name):
module = self.load_module(self.name)
self.verify(module)
- def test_nonexistent(self):
+ def test_package(self):
+ # Built-in modules cannot be a package.
+ pass
+
+ def test_lacking_parent(self):
+ # Built-in modules cannot be a package.
+ pass
+
+ def test_state_after_failure(self):
+ # Not way to force an imoprt failure.
+ pass
+
+ def test_module_reuse(self):
+ # Test that the same module is used in a reload.
+ with support.uncache(self.name):
+ module1 = self.load_module(self.name)
+ module2 = self.load_module(self.name)
+ self.assert_(module1 is module2)
+
+ def test_unloadable(self):
name = 'dssdsdfff'
assert name not in sys.builtin_module_names
self.assertRaises(ImportError, self.load_module, name)