close open file from find_module()

This commit is contained in:
Benjamin Peterson 2010-10-30 23:06:57 +00:00
parent 1c87e2943a
commit e048797991

View file

@ -128,6 +128,7 @@ def test_imp_module(self):
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)