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

Method test_shutdown

Lib/test/test_socketserver.py:240–263  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

238
239 @threading_helper.reap_threads
240 def test_shutdown(self):
241 # Issue #2302: shutdown() should always succeed in making an
242 # other thread leave serve_forever().
243 class MyServer(socketserver.TCPServer):
244 pass
245
246 class MyHandler(socketserver.StreamRequestHandler):
247 pass
248
249 threads = []
250 for i in range(20):
251 s = MyServer((HOST, 0), MyHandler)
252 t = threading.Thread(
253 name='MyServer serving',
254 target=s.serve_forever,
255 kwargs={'poll_interval':0.01})
256 t.daemon = True # In case this function raises.
257 threads.append((t, s))
258 for t, s in threads:
259 t.start()
260 s.shutdown()
261 for t, s in threads:
262 t.join()
263 s.server_close()
264
265 def test_close_immediately(self):
266 class MyServer(socketserver.ThreadingMixIn, socketserver.TCPServer):

Callers

nothing calls this directly

Calls 6

startMethod · 0.95
joinMethod · 0.95
MyServerClass · 0.70
appendMethod · 0.45
shutdownMethod · 0.45
server_closeMethod · 0.45

Tested by

no test coverage detected