[issue16302] Fix ResourceWarning in Lib/test/test_urllib.py

2012-10-22 Thread Berker Peksag
Berker Peksag added the comment: You are right, thanks Senthil. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscrib

[issue16302] Fix ResourceWarning in Lib/test/test_urllib.py

2012-10-22 Thread Senthil Kumaran
Senthil Kumaran added the comment: Fixed in 478cda291bbc Berker - with urlopen(tmp_fileurl) as fobj: self.assertTrue(fobj) is enough when using context manager as the fobj gets closed automatically at exiting of context. Thanks. -- resolution: -> fixed status: open ->

[issue16302] Fix ResourceWarning in Lib/test/test_urllib.py

2012-10-22 Thread Berker Peksag
Berker Peksag added the comment: Thanks for the suggestion, Serhiy. Attached a new patch. -- Added file: http://bugs.python.org/file27663/resourcewarning_urllib_test_v2.patch ___ Python tracker __

[issue16302] Fix ResourceWarning in Lib/test/test_urllib.py

2012-10-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: You can use contextlib.closing() context manager (if urlopen() already does not return a context manager). -- nosy: +serhiy.storchaka ___ Python tracker

[issue16302] Fix ResourceWarning in Lib/test/test_urllib.py

2012-10-22 Thread Senthil Kumaran
Senthil Kumaran added the comment: thanks for the bug-report/patch. -- nosy: +orsenthil ___ Python tracker ___ ___ Python-bugs-list ma

[issue16302] Fix ResourceWarning in Lib/test/test_urllib.py

2012-10-22 Thread Berker Peksag
New submission from Berker Peksag: See the output: test_file_notexists (test.test_urllib.urlopen_HttpTests) ... file:///tmp/tmpmlmjhf /home/berker/hacking/cpython/Lib/test/test_urllib.py:284: ResourceWarning: unclosed file <_io.BufferedReader name='/tmp/tmpmlmjhf'> self.assertTrue(urlopen(tm