MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_socketserver

Method test_socketserver

Lib/test/test_ssl.py:3501–3525  ·  view source on GitHub ↗

Using socketserver to create and manage SSL connections.

(self)

Source from the content-addressed store, hash-verified

3499 s.close()
3500
3501 def test_socketserver(self):
3502 """Using socketserver to create and manage SSL connections."""
3503 server = make_https_server(self, certfile=SIGNED_CERTFILE)
3504 # try to connect
3505 if support.verbose:
3506 sys.stdout.write('\n')
3507 # Get this test file itself:
3508 with open(__file__, 'rb') as f:
3509 d1 = f.read()
3510 d2 = ''
3511 # now fetch the same data from the HTTPS server
3512 url = f'https://localhost:{server.port}/test_ssl.py'
3513 context = ssl.create_default_context(cafile=SIGNING_CA)
3514 f = urllib.request.urlopen(url, context=context)
3515 try:
3516 dlen = f.info().get("content-length")
3517 if dlen and (int(dlen) > 0):
3518 d2 = f.read(int(dlen))
3519 if support.verbose:
3520 sys.stdout.write(
3521 " client: read %d bytes from remote server '%s'\n"
3522 % (len(d2), server))
3523 finally:
3524 f.close()
3525 self.assertEqual(d1, d2)
3526
3527 def test_asyncore_server(self):
3528 """Check the example asyncore integration."""

Callers

nothing calls this directly

Calls 10

make_https_serverFunction · 0.90
lenFunction · 0.85
openFunction · 0.50
writeMethod · 0.45
readMethod · 0.45
urlopenMethod · 0.45
getMethod · 0.45
infoMethod · 0.45
closeMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected