[Python-checkins] cpython: Fix the ResourceWarning in test_urllib.py due changes made for #16301. Patch by

senthil.kumaran python-checkins at python.org
Tue Oct 23 02:06:50 CEST 2012


http://hg.python.org/cpython/rev/478cda291bbc
changeset:   79901:478cda291bbc
user:        Senthil Kumaran <senthil at uthcode.com>
date:        Mon Oct 22 17:06:43 2012 -0700
summary:
  Fix the ResourceWarning in test_urllib.py due changes made for #16301. Patch by Berker Peksag

files:
  Lib/test/test_urllib.py |  3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -280,7 +280,8 @@
         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))

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list