diff options
author | Brett Cannon <brett@python.org> | 2012-04-14 18:10:13 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2012-04-14 18:10:13 (GMT) |
commit | fd0741555b733f66c0a35c698d0cac5e73010ae0 (patch) | |
tree | 739b3aeb0a9d31f49dd334e5f57b5376b20d7dc7 /Lib/test/test_pkg.py | |
parent | d2cbd9053975d6d6a98adb23b2735b2125ed0626 (diff) | |
download | cpython-fd0741555b733f66c0a35c698d0cac5e73010ae0.zip cpython-fd0741555b733f66c0a35c698d0cac5e73010ae0.tar.gz cpython-fd0741555b733f66c0a35c698d0cac5e73010ae0.tar.bz2 |
Issue #2377: Make importlib the implementation of __import__().
importlib._bootstrap is now frozen into Python/importlib.h and stored
as _frozen_importlib in sys.modules. Py_Initialize() loads the frozen
code along with sys and imp and then uses _frozen_importlib._install()
to set builtins.__import__() w/ _frozen_importlib.__import__().
Diffstat (limited to 'Lib/test/test_pkg.py')
-rw-r--r-- | Lib/test/test_pkg.py | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/Lib/test/test_pkg.py b/Lib/test/test_pkg.py index a4ddb15..4d0eee8 100644 --- a/Lib/test/test_pkg.py +++ b/Lib/test/test_pkg.py @@ -196,14 +196,15 @@ class TestPkg(unittest.TestCase): import t5 self.assertEqual(fixdir(dir(t5)), - ['__cached__', '__doc__', '__file__', '__name__', - '__package__', '__path__', 'foo', 'string', 't5']) + ['__cached__', '__doc__', '__file__', '__loader__', + '__name__', '__package__', '__path__', 'foo', + 'string', 't5']) self.assertEqual(fixdir(dir(t5.foo)), - ['__cached__', '__doc__', '__file__', '__name__', - '__package__', 'string']) + ['__cached__', '__doc__', '__file__', '__loader__', + '__name__', '__package__', 'string']) self.assertEqual(fixdir(dir(t5.string)), - ['__cached__', '__doc__', '__file__', '__name__', - '__package__', 'spam']) + ['__cached__', '__doc__', '__file__', '__loader__', + '__name__', '__package__', 'spam']) def test_6(self): hier = [ @@ -219,14 +220,14 @@ class TestPkg(unittest.TestCase): import t6 self.assertEqual(fixdir(dir(t6)), ['__all__', '__cached__', '__doc__', '__file__', - '__name__', '__package__', '__path__']) + '__loader__', '__name__', '__package__', '__path__']) s = """ import t6 from t6 import * self.assertEqual(fixdir(dir(t6)), ['__all__', '__cached__', '__doc__', '__file__', - '__name__', '__package__', '__path__', - 'eggs', 'ham', 'spam']) + '__loader__', '__name__', '__package__', + '__path__', 'eggs', 'ham', 'spam']) self.assertEqual(dir(), ['eggs', 'ham', 'self', 'spam', 't6']) """ self.run_code(s) @@ -252,19 +253,19 @@ class TestPkg(unittest.TestCase): t7, sub, subsub = None, None, None import t7 as tas self.assertEqual(fixdir(dir(tas)), - ['__cached__', '__doc__', '__file__', '__name__', - '__package__', '__path__']) + ['__cached__', '__doc__', '__file__', '__loader__', + '__name__', '__package__', '__path__']) self.assertFalse(t7) from t7 import sub as subpar self.assertEqual(fixdir(dir(subpar)), - ['__cached__', '__doc__', '__file__', '__name__', - '__package__', '__path__']) + ['__cached__', '__doc__', '__file__', '__loader__', + '__name__', '__package__', '__path__']) self.assertFalse(t7) self.assertFalse(sub) from t7.sub import subsub as subsubsub self.assertEqual(fixdir(dir(subsubsub)), - ['__cached__', '__doc__', '__file__', '__name__', - '__package__', '__path__', 'spam']) + ['__cached__', '__doc__', '__file__', '__loader__', + '__name__', '__package__', '__path__', 'spam']) self.assertFalse(t7) self.assertFalse(sub) self.assertFalse(subsub) |