diff options
| 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 |
| commit | 3b9b511708f987254fdcfdc5fc0f020d7a0ab923 (patch) | |
| tree | 82f339b6ba103187ad9d240efc2df04aa0b42b4d /tests/test_dir_util.py | |
| parent | 91b89f544e774b04a09af9d1849334f4f7dc20b5 (diff) | |
| download | python-setuptools-git-3b9b511708f987254fdcfdc5fc0f020d7a0ab923.tar.gz | |
Always close files in distutils code and tests (#10252).
Diffstat (limited to 'tests/test_dir_util.py')
| -rw-r--r-- | tests/test_dir_util.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/test_dir_util.py b/tests/test_dir_util.py index a1647fbc..aa9f9ebb 100644 --- a/tests/test_dir_util.py +++ b/tests/test_dir_util.py @@ -88,8 +88,10 @@ class DirUtilTestCase(support.TempdirManager, unittest.TestCase): mkpath(self.target, verbose=0) a_file = os.path.join(self.target, 'ok.txt') f = open(a_file, 'w') - f.write('some content') - f.close() + try: + f.write('some content') + finally: + f.close() wanted = ['copying %s -> %s' % (a_file, self.target2)] copy_tree(self.target, self.target2, verbose=1) |
