summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/tests/test_core.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/distutils/tests/test_core.py')
-rw-r--r--Lib/distutils/tests/test_core.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/distutils/tests/test_core.py b/Lib/distutils/tests/test_core.py
index 48ec1b4..63f6b31 100644
--- a/Lib/distutils/tests/test_core.py
+++ b/Lib/distutils/tests/test_core.py
@@ -52,7 +52,11 @@ class CoreTestCase(support.EnvironGuard, unittest.TestCase):
shutil.rmtree(path)
def write_setup(self, text, path=test.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):