From: Benjamin Peterson Date: Sat, 30 Oct 2010 23:06:57 +0000 (+0000) Subject: close open file from find_module() X-Git-Tag: v3.2a4~245 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e048797991d4ea568c4d3eacf37cc2c3f0f5a344;p=python close open file from find_module() --- diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py index 10b32d35d1..02f56e6217 100644 --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -128,6 +128,7 @@ class ImportTests(unittest.TestCase): orig_getenv = os.getenv with EnvironmentVarGuard(): x = imp.find_module("os") + self.addCleanup(x[0].close) new_os = imp.load_module("os", *x) self.assertIs(os, new_os) self.assertIs(orig_path, new_os.path)