summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_urllib2.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_urllib2.py')
-rw-r--r--Lib/test/test_urllib2.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
index 876fcd4..c6d275e 100644
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -57,10 +57,8 @@ class TrivialTests(unittest.TestCase):
else:
file_url = "file://%s" % fname
- f = urllib.request.urlopen(file_url)
-
- f.read()
- f.close()
+ with urllib.request.urlopen(file_url) as f:
+ f.read()
def test_parse_http_list(self):
tests = [