Issue #18193: Add importlib.reload(), documenting (but not

implementing in code) the deprecation of imp.reload().

Thanks to Berker Peksag for the patch.
This commit is contained in:
Brett Cannon 2013-06-14 15:04:26 -04:00
parent 6f1057605b
commit 3fe35e6503
6 changed files with 122 additions and 24 deletions

View file

@ -151,6 +151,18 @@ class FindLoaderTests(unittest.TestCase):
self.assertIsNone(importlib.find_loader('nevergoingtofindthismodule'))
class ReloadTests(unittest.TestCase):
"""Test module reloading for builtin and extension modules."""
def test_reload_modules(self):
for mod in ('tokenize', 'time', 'marshal'):
with self.subTest(module=mod):
with support.CleanImport(mod):
module = importlib.import_module(mod)
importlib.reload(module)
class InvalidateCacheTests(unittest.TestCase):
def test_method_called(self):