]> granicus.if.org Git - python/commitdiff
Fix test for new version of urllib that uses HTTPConnection directly.
authorJeremy Hylton <jeremy@alum.mit.edu>
Sat, 4 Aug 2007 19:23:09 +0000 (19:23 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Sat, 4 Aug 2007 19:23:09 +0000 (19:23 +0000)
Changes the way the httplib classes are stubbed out.

Lib/test/test_urllib.py

index a31bb52e31741fb7c585117644721c1755d32df5..dde5d581d84a8b77ccf6f1771f60e205e62d6c05 100644 (file)
@@ -111,11 +111,11 @@ class urlopen_HttpTests(unittest.TestCase):
         class FakeHTTPConnection(httplib.HTTPConnection):
             def connect(self):
                 self.sock = FakeSocket(fakedata)
-        assert httplib.HTTP._connection_class == httplib.HTTPConnection
-        httplib.HTTP._connection_class = FakeHTTPConnection
+        self._connection_class = httplib.HTTPConnection
+        httplib.HTTPConnection = FakeHTTPConnection
 
     def unfakehttp(self):
-        httplib.HTTP._connection_class = httplib.HTTPConnection
+        httplib.HTTPConnection = self._connection_class
 
     def test_read(self):
         self.fakehttp(b"Hello!")