summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2014-05-13 18:18:07 (GMT)
committerEric Snow <ericsnowcurrently@gmail.com>2014-05-13 18:18:07 (GMT)
commite1c9e5270abf0076f87a667fbb47a6a0d5403f7f (patch)
treeeecd236d703f747cb6a24950e758095fcf098f8f /Lib/test/test_importlib
parentc7188e2690b3c115ae56010737ca133c6549e688 (diff)
parent2f46a0e8bef2e0a29e032ef805e9a95924af00a7 (diff)
downloadcpython-e1c9e5270abf0076f87a667fbb47a6a0d5403f7f.zip
cpython-e1c9e5270abf0076f87a667fbb47a6a0d5403f7f.tar.gz
cpython-e1c9e5270abf0076f87a667fbb47a6a0d5403f7f.tar.bz2
Merge from 3.4 (for #21499).
Diffstat (limited to 'Lib/test/test_importlib')
-rw-r--r--Lib/test/test_importlib/test_api.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/Lib/test/test_importlib/test_api.py b/Lib/test/test_importlib/test_api.py
index 744001b..2a2d42b 100644
--- a/Lib/test/test_importlib/test_api.py
+++ b/Lib/test/test_importlib/test_api.py
@@ -241,13 +241,13 @@ class ReloadTests:
'__file__': path,
'__cached__': cached,
'__doc__': None,
- '__builtins__': __builtins__,
}
support.create_empty_file(path)
module = self.init.import_module(name)
- ns = vars(module)
+ ns = vars(module).copy()
loader = ns.pop('__loader__')
spec = ns.pop('__spec__')
+ ns.pop('__builtins__', None) # An implementation detail.
self.assertEqual(spec.name, name)
self.assertEqual(spec.loader, loader)
self.assertEqual(loader.path, path)
@@ -263,14 +263,14 @@ class ReloadTests:
'__cached__': cached,
'__path__': [os.path.dirname(init_path)],
'__doc__': None,
- '__builtins__': __builtins__,
}
os.mkdir(name)
os.rename(path, init_path)
reloaded = self.init.reload(module)
- ns = vars(reloaded)
+ ns = vars(reloaded).copy()
loader = ns.pop('__loader__')
spec = ns.pop('__spec__')
+ ns.pop('__builtins__', None) # An implementation detail.
self.assertEqual(spec.name, name)
self.assertEqual(spec.loader, loader)
self.assertIs(reloaded, module)
@@ -295,10 +295,11 @@ class ReloadTests:
with open(bad_path, 'w') as init_file:
init_file.write('eggs = None')
module = self.init.import_module(name)
- ns = vars(module)
+ ns = vars(module).copy()
loader = ns.pop('__loader__')
path = ns.pop('__path__')
spec = ns.pop('__spec__')
+ ns.pop('__builtins__', None) # An implementation detail.
self.assertEqual(spec.name, name)
self.assertIs(spec.loader, None)
self.assertIsNot(loader, None)
@@ -319,14 +320,14 @@ class ReloadTests:
'__cached__': cached,
'__path__': [os.path.dirname(init_path)],
'__doc__': None,
- '__builtins__': __builtins__,
'eggs': None,
}
os.rename(bad_path, init_path)
reloaded = self.init.reload(module)
- ns = vars(reloaded)
+ ns = vars(reloaded).copy()
loader = ns.pop('__loader__')
spec = ns.pop('__spec__')
+ ns.pop('__builtins__', None) # An implementation detail.
self.assertEqual(spec.name, name)
self.assertEqual(spec.loader, loader)
self.assertIs(reloaded, module)