@@ -2210,10 +2210,10 @@ def get_zlib_library(self, cmake):
2210
2210
return rtn
2211
2211
2212
2212
2213
- # Run a server and a web page. When a test runs, we tell the server about it,
2213
+ # Create a server and a web page. When a test runs, we tell the server about it,
2214
2214
# which tells the web page, which then opens a window with the test. Doing
2215
2215
# it this way then allows the page to close() itself when done.
2216
- def harness_server_func (in_queue , out_queue , port ):
2216
+ def make_test_server (in_queue , out_queue , port ):
2217
2217
class TestServerHandler (SimpleHTTPRequestHandler ):
2218
2218
# Request header handler for default do_GET() path in
2219
2219
# SimpleHTTPRequestHandler.do_GET(self) below.
@@ -2394,20 +2394,16 @@ def log_request(code=0, size=0):
2394
2394
2395
2395
class HttpServerThread (threading .Thread ):
2396
2396
"""A generic thread class to create and run an http server."""
2397
- def __init__ (self , server_creator , * server_args ):
2397
+ def __init__ (self , server ):
2398
2398
super ().__init__ ()
2399
- self .server = None
2400
- self .server_creator = server_creator
2401
- self .server_args = server_args
2399
+ self .server = server
2402
2400
2403
2401
def stop (self ):
2404
2402
"""Shuts down the server if it is running."""
2405
- if self .server :
2406
- self .server .shutdown ()
2403
+ self .server .shutdown ()
2407
2404
2408
2405
def run (self ):
2409
2406
"""Creates the server instance and serves forever until stop() is called."""
2410
- self .server = self .server_creator (* self .server_args )
2411
2407
# Start the server's main loop (this blocks until shutdown() is called)
2412
2408
self .server .serve_forever ()
2413
2409
@@ -2504,7 +2500,7 @@ def setUpClass(cls):
2504
2500
2505
2501
cls .harness_in_queue = queue .Queue ()
2506
2502
cls .harness_out_queue = queue .Queue ()
2507
- cls .harness_server = HttpServerThread (harness_server_func , cls .harness_in_queue , cls .harness_out_queue , cls .PORT )
2503
+ cls .harness_server = HttpServerThread (make_test_server ( cls .harness_in_queue , cls .harness_out_queue , cls .PORT ) )
2508
2504
cls .harness_server .start ()
2509
2505
2510
2506
print (f'[Browser harness server on thread { cls .harness_server .name } ]' )
0 commit comments