Kaydet (Commit) ec0c508b authored tarafından Jeremy Hylton's avatar Jeremy Hylton

Fix an absurdly invasive test.

Checks that an io object somewhere in the stack of wrappers is
actually closed.  --This line, and those below, will be ignored--

M    test_urllib2net.py
üst 8fff7924
...@@ -75,11 +75,9 @@ class CloseSocketTest(unittest.TestCase): ...@@ -75,11 +75,9 @@ class CloseSocketTest(unittest.TestCase):
# delve deep into response to fetch socket._socketobject # delve deep into response to fetch socket._socketobject
response = urllib2.urlopen("http://www.python.org/") response = urllib2.urlopen("http://www.python.org/")
abused_fileobject = response.fp abused_fileobject = response.fp
self.assert_(abused_fileobject.__class__ is socket._fileobject) httpresponse = abused_fileobject.raw
httpresponse = abused_fileobject._sock
self.assert_(httpresponse.__class__ is httplib.HTTPResponse) self.assert_(httpresponse.__class__ is httplib.HTTPResponse)
fileobject = httpresponse.fp fileobject = httpresponse.fp
self.assert_(fileobject.__class__ is socket._fileobject)
self.assert_(not fileobject.closed) self.assert_(not fileobject.closed)
response.close() response.close()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment