summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/tests/test_build_scripts.py
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2010-11-05 23:51:56 (GMT)
committerÉric Araujo <merwok@netwok.org>2010-11-05 23:51:56 (GMT)
commitbee5cef7dbff40734c347da5b93797e8db9103e8 (patch)
tree06dcc726207cfad3016f2b0f7c365fb9fe5b3cc6 /Lib/distutils/tests/test_build_scripts.py
parentafb078dd2673d919ac3733104757c441f256f30f (diff)
downloadcpython-bee5cef7dbff40734c347da5b93797e8db9103e8.zip
cpython-bee5cef7dbff40734c347da5b93797e8db9103e8.tar.gz
cpython-bee5cef7dbff40734c347da5b93797e8db9103e8.tar.bz2
Always close files in distutils code and tests (#10252).
Diffstat (limited to 'Lib/distutils/tests/test_build_scripts.py')
-rw-r--r--Lib/distutils/tests/test_build_scripts.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/distutils/tests/test_build_scripts.py b/Lib/distutils/tests/test_build_scripts.py
index b1d2d07..85b0400 100644
--- a/Lib/distutils/tests/test_build_scripts.py
+++ b/Lib/distutils/tests/test_build_scripts.py
@@ -71,8 +71,10 @@ class BuildScriptsTestCase(support.TempdirManager,
def write_script(self, dir, name, text):
f = open(os.path.join(dir, name), "w")
- f.write(text)
- f.close()
+ try:
+ f.write(text)
+ finally:
+ f.close()
def test_version_int(self):
source = self.mkdtemp()