summaryrefslogtreecommitdiff
path: root/tests/test_core.py
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2010-11-05 23:51:56 +0000
committerÉric Araujo <merwok@netwok.org>2010-11-05 23:51:56 +0000
commit3b9b511708f987254fdcfdc5fc0f020d7a0ab923 (patch)
tree82f339b6ba103187ad9d240efc2df04aa0b42b4d /tests/test_core.py
parent91b89f544e774b04a09af9d1849334f4f7dc20b5 (diff)
downloadpython-setuptools-git-3b9b511708f987254fdcfdc5fc0f020d7a0ab923.tar.gz
Always close files in distutils code and tests (#10252).
Diffstat (limited to 'tests/test_core.py')
-rw-r--r--tests/test_core.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/test_core.py b/tests/test_core.py
index b478fa62..e937b45a 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -52,7 +52,11 @@ class CoreTestCase(support.EnvironGuard, unittest.TestCase):
shutil.rmtree(path)
def write_setup(self, text, path=test.support.TESTFN):
- open(path, "w").write(text)
+ f = open(path, "w")
+ try:
+ f.write(text)
+ finally:
+ f.close()
return path
def test_run_setup_provides_file(self):