MCPcopy Index your code
hub / github.com/python/cpython / FakeSocketHTTPConnection

Class FakeSocketHTTPConnection

Lib/test/test_httplib.py:120–135  ·  view source on GitHub ↗

HTTPConnection subclass using FakeSocket; counts connect() calls

Source from the content-addressed store, hash-verified

118 return data
119
120class FakeSocketHTTPConnection(client.HTTPConnection):
121 """HTTPConnection subclass using FakeSocket; counts connect() calls"""
122
123 def __init__(self, *args):
124 self.connections = 0
125 super().__init__('example.com')
126 self.fake_socket_args = args
127 self._create_connection = self.create_connection
128
129 def connect(self):
130 """Count the number of times connect() is invoked"""
131 self.connections += 1
132 return super().connect()
133
134 def create_connection(self, *pos, **kw):
135 return FakeSocket(*self.fake_socket_args)
136
137class HeaderTests(TestCase):
138 def test_auto_headers(self):

Callers 3

test_reuse_reconnectMethod · 0.85
test_disconnectedMethod · 0.85
test_100_closeMethod · 0.85

Calls

no outgoing calls

Tested by 3

test_reuse_reconnectMethod · 0.68
test_disconnectedMethod · 0.68
test_100_closeMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…