Commit 7f462fc8 authored by Brett Cannon's avatar Brett Cannon

Fix file closing in test_http_cookiejar.

parent 918e2d48
...@@ -263,11 +263,11 @@ class FileCookieJarTests(unittest.TestCase): ...@@ -263,11 +263,11 @@ class FileCookieJarTests(unittest.TestCase):
# Invalid contents of cookies file (eg. bad magic string) # Invalid contents of cookies file (eg. bad magic string)
# causes a LoadError. # causes a LoadError.
try: try:
f = open(filename, "w") with open(filename, "w") as f:
f.write("oops\n") f.write("oops\n")
for cookiejar_class in LWPCookieJar, MozillaCookieJar: for cookiejar_class in LWPCookieJar, MozillaCookieJar:
c = cookiejar_class() c = cookiejar_class()
self.assertRaises(LoadError, c.load, filename) self.assertRaises(LoadError, c.load, filename)
finally: finally:
try: os.unlink(filename) try: os.unlink(filename)
except OSError: pass except OSError: pass
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment