[Python-Dev] cpython (3.2): Fix closes Issue12576 (original) (raw)
[Python-Dev] cpython (3.2): Fix closes Issue12576 - fix urlopen behavior on sites which do not send (or
Antoine Pitrou solipsis at pitrou.net
Wed Jul 27 11:52:32 CEST 2011
- Previous message: [Python-Dev] [Python-checkins] cpython (2.7): Issue #8746: Correct faulty configure checks so that os.chflags() and
- Next message: [Python-Dev] cpython (3.2): Fix closes Issue12576 - fix urlopen behavior on sites which do not send (or
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, 27 Jul 2011 02:25:56 +0200 senthil.kumaran <python-checkins at python.org> wrote:
+ def testsitesnoconnectionclose(self): + # Some sites do not send Connection: close header. + # Verify that those work properly. (#issue12576) + + try: + with urllib.request.urlopen('http://www.imdb.com') as res: + pass
Can you please at least use support.transient_internet() as in other tests in this file?
+ except ValueError as e: + self.fail("urlopen failed for sites not sending Connection:close") + else: + self.assertTrue(res) + + req = urllib.request.urlopen('http://www.imdb.com')
Why a second time?
+ res = req.read() + self.assertTrue(res)
Also, when does "req" get closed? Right now I get resource warnings:
test_sites_no_connection_close (test.test_urllib2net.OtherNetworkTests) ... /home/antoine/cpython/default/Lib/socket.py:342: ResourceWarning: unclosed <socket.socket object, fd=3, family=2, type=1, proto=6> self._sock = None /home/antoine/cpython/default/Lib/socket.py:342: ResourceWarning: unclosed <socket.socket object, fd=3, family=2, type=1, proto=6> self._sock = None ok
Regards
Antoine.
- Previous message: [Python-Dev] [Python-checkins] cpython (2.7): Issue #8746: Correct faulty configure checks so that os.chflags() and
- Next message: [Python-Dev] cpython (3.2): Fix closes Issue12576 - fix urlopen behavior on sites which do not send (or
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]