summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_http_cookiejar.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2010-10-29 23:27:39 (GMT)
committerBrett Cannon <bcannon@gmail.com>2010-10-29 23:27:39 (GMT)
commit7f462fc8351ba4e02a12ff9a81df3e84324a4130 (patch)
tree6a9bbcb1db5f195e3353365990a131453bd28917 /Lib/test/test_http_cookiejar.py
parent918e2d48329510a7d9d7e781444732fa839c8d15 (diff)
downloadcpython-7f462fc8351ba4e02a12ff9a81df3e84324a4130.zip
cpython-7f462fc8351ba4e02a12ff9a81df3e84324a4130.tar.gz
cpython-7f462fc8351ba4e02a12ff9a81df3e84324a4130.tar.bz2
Fix file closing in test_http_cookiejar.
Diffstat (limited to 'Lib/test/test_http_cookiejar.py')
-rw-r--r--Lib/test/test_http_cookiejar.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/test_http_cookiejar.py b/Lib/test/test_http_cookiejar.py
index c867bbc..fca6710 100644
--- a/Lib/test/test_http_cookiejar.py
+++ b/Lib/test/test_http_cookiejar.py
@@ -263,11 +263,11 @@ class FileCookieJarTests(unittest.TestCase):
# Invalid contents of cookies file (eg. bad magic string)
# causes a LoadError.
try:
- f = open(filename, "w")
- f.write("oops\n")
- for cookiejar_class in LWPCookieJar, MozillaCookieJar:
- c = cookiejar_class()
- self.assertRaises(LoadError, c.load, filename)
+ with open(filename, "w") as f:
+ f.write("oops\n")
+ for cookiejar_class in LWPCookieJar, MozillaCookieJar:
+ c = cookiejar_class()
+ self.assertRaises(LoadError, c.load, filename)
finally:
try: os.unlink(filename)
except OSError: pass