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

Method make_server

Lib/test/test_socketserver.py:89–108  ·  view source on GitHub ↗
(self, addr, svrcls, hdlrbase)

Source from the content-addressed store, hash-verified

87 return fn
88
89 def make_server(self, addr, svrcls, hdlrbase):
90 class MyServer(svrcls):
91 def handle_error(self, request, client_address):
92 self.close_request(request)
93 raise
94
95 class MyHandler(hdlrbase):
96 def handle(self):
97 line = self.rfile.readline()
98 self.wfile.write(line)
99
100 if verbose: print("creating server")
101 try:
102 server = MyServer(addr, MyHandler)
103 except PermissionError as e:
104 # Issue 29184: cannot bind() a Unix socket on Android.
105 self.skipTest('Cannot create server (%s, %s): %s' %
106 (svrcls, addr, e))
107 self.assertEqual(server.server_address, server.socket.getsockname())
108 return server
109
110 @threading_helper.reap_threads
111 def run_server(self, svrcls, hdlrbase, testfunc):

Callers 1

run_serverMethod · 0.95

Calls 5

skipTestMethod · 0.80
MyServerClass · 0.70
printFunction · 0.50
assertEqualMethod · 0.45
getsocknameMethod · 0.45

Tested by

no test coverage detected