[testing] Use threads for the http servers. - #25141
Conversation
sbc100
left a comment
There was a problem hiding this comment.
Can you remind me why "sub processes aren't allowed."?
|
|
||
| class ServerThread(threading.Thread): | ||
| """A generic thread class to create and run a server.""" | ||
| def __init__(self, server_creator, *server_args): |
There was a problem hiding this comment.
server_ctor or server_constructor.. or maybe server_class?
There was a problem hiding this comment.
It takes a function, so I don't think those names work.
Workers in the pool are already daemon processes and do not allow you to create sub processes. More on the daemonic stuff: https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Process.daemon |
This is in preparation for the parallel browser tests where sub processes aren't allowed. The server no longer changes the directory during tests, since we can now rely on the test runner changing the directory (same process).
724a71c to
a34bc70
Compare
|
|
||
| cls.harness_in_queue = queue.Queue() | ||
| cls.harness_out_queue = queue.Queue() | ||
| cls.harness_server = HttpServerThread(harness_server_func, cls.harness_in_queue, cls.harness_out_queue, cls.PORT) |
There was a problem hiding this comment.
Can we at least rename harness_server_func to something like make_test_server or make_test_harness since that function now returns that server rather than running it?
This is in preparation for the parallel browser tests where sub processes aren't allowed. The server no longer changes the directory during tests, since we can now rely on the test runner changing the directory (same process).
This is in preparation for the parallel browser tests where sub processes aren't allowed.
The server no longer changes the directory during tests, since we can now rely on the test runner changing the directory (same process).