summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_cgi.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-10-30 22:59:37 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-10-30 22:59:37 (GMT)
commit807a5a165254f7d82cceb4c3bed72b84661ef89f (patch)
tree43ebe7f9485f3d41a89cf9a75107852c67e3bd89 /Lib/test/test_cgi.py
parent9f5f65c736745cfd11efee0418dfb98d1ddec93d (diff)
downloadcpython-807a5a165254f7d82cceb4c3bed72b84661ef89f.zip
cpython-807a5a165254f7d82cceb4c3bed72b84661ef89f.tar.gz
cpython-807a5a165254f7d82cceb4c3bed72b84661ef89f.tar.bz2
close files properly
Diffstat (limited to 'Lib/test/test_cgi.py')
-rw-r--r--Lib/test/test_cgi.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/test/test_cgi.py b/Lib/test/test_cgi.py
index fc84214..4347668 100644
--- a/Lib/test/test_cgi.py
+++ b/Lib/test/test_cgi.py
@@ -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.