From 3fe35e65034de82c45e2d8fe1ebe4a2929c68453 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Fri, 14 Jun 2013 15:04:26 -0400 Subject: Issue #18193: Add importlib.reload(), documenting (but not implementing in code) the deprecation of imp.reload(). Thanks to Berker Peksag for the patch. --- Lib/test/test_importlib/test_api.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'Lib/test/test_importlib/test_api.py') diff --git a/Lib/test/test_importlib/test_api.py b/Lib/test/test_importlib/test_api.py index 297d6cbef6..330c04ea02 100644 --- a/Lib/test/test_importlib/test_api.py +++ b/Lib/test/test_importlib/test_api.py @@ -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): -- cgit v1.2.1