[Python-checkins] r85950 - python/branches/py3k/Lib/test/test_http_cookiejar.py
brett.cannon
python-checkins at python.org
Sat Oct 30 01:27:39 CEST 2010
Author: brett.cannon
Date: Sat Oct 30 01:27:39 2010
New Revision: 85950
Log:
Fix file closing in test_http_cookiejar.
Modified:
python/branches/py3k/Lib/test/test_http_cookiejar.py
Modified: python/branches/py3k/Lib/test/test_http_cookiejar.py
==============================================================================
--- python/branches/py3k/Lib/test/test_http_cookiejar.py (original)
+++ python/branches/py3k/Lib/test/test_http_cookiejar.py Sat Oct 30 01:27:39 2010
@@ -263,11 +263,11 @@
# 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
More information about the Python-checkins
mailing list