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

Method test_client

Lib/test/test_asyncio/test_ssl.py:231–258  ·  view source on GitHub ↗
(addr)

Source from the content-addressed store, hash-verified

229 CNT += 1
230
231 async def test_client(addr):
232 fut = asyncio.Future()
233
234 def prog(sock):
235 try:
236 sock.starttls(client_sslctx)
237 sock.connect(addr)
238 sock.send(A_DATA)
239
240 data = sock.recv_all(2)
241 self.assertEqual(data, b'OK')
242
243 sock.send(B_DATA)
244 data = sock.recv_all(4)
245 self.assertEqual(data, b'SPAM')
246
247 sock.close()
248
249 except Exception as ex:
250 self.loop.call_soon_threadsafe(fut.set_exception, ex)
251 else:
252 self.loop.call_soon_threadsafe(fut.set_result, None)
253
254 client = self.tcp_client(prog)
255 client.start()
256 clients.append(client)
257
258 await fut
259
260 async def start_server():
261 srv = await asyncio.start_server(

Callers

nothing calls this directly

Calls 3

tcp_clientMethod · 0.95
startMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected