]> granicus.if.org Git - python/commitdiff
close files properly
authorBenjamin Peterson <benjamin@python.org>
Sat, 30 Oct 2010 22:59:37 +0000 (22:59 +0000)
committerBenjamin Peterson <benjamin@python.org>
Sat, 30 Oct 2010 22:59:37 +0000 (22:59 +0000)
Lib/test/test_cgi.py

index fc842145932f45ecb654db5b1c61687f9895e9dd..4347668c78d5163960979ccb0e5e46761da7a770 100644 (file)
@@ -182,10 +182,12 @@ class CgiTests(unittest.TestCase):
                 return a
 
         f = TestReadlineFile(tempfile.TemporaryFile("w+"))
+        self.addCleanup(f.close)
         f.write('x' * 256 * 1024)
         f.seek(0)
         env = {'REQUEST_METHOD':'PUT'}
         fs = cgi.FieldStorage(fp=f, environ=env)
+        self.addCleanup(fs.file.close)
         # if we're not chunking properly, readline is only called twice
         # (by read_binary); if we are chunking properly, it will be called 5 times
         # as long as the chunksize is 1 << 16.