From: Senthil Kumaran Date: Tue, 23 Oct 2012 00:06:43 +0000 (-0700) Subject: Fix the ResourceWarning in test_urllib.py due changes made for #16301. Patch by Berke... X-Git-Tag: v3.4.0a1~2189 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3a8158071929ad1a1e58d1540dab21d44b2fdb61;p=python Fix the ResourceWarning in test_urllib.py due changes made for #16301. Patch by Berker Peksag --- diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py index e2d306fc28..276568dad4 100644 --- a/Lib/test/test_urllib.py +++ b/Lib/test/test_urllib.py @@ -280,7 +280,8 @@ Content-Type: text/html; charset=iso-8859-1 tmp_fileurl = 'file://localhost' + tmp_file self.assertTrue(os.path.exists(tmp_file)) - self.assertTrue(urlopen(tmp_fileurl)) + with urlopen(tmp_fileurl) as fobj: + self.assertTrue(fobj) os.unlink(tmp_file) self.assertFalse(os.path.exists(tmp_file))