'__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)
'__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)
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)
'__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)