LiveServerThread
Thread for running a live HTTP server while the tests are running.
Attributes
| Attribute | Type | Description |
|---|---|---|
| server_class | class = ThreadedWSGIServer | The server class used to instantiate the HTTP server, defaulting to ThreadedWSGIServer. |
Constructor
Signature
def LiveServerThread(
host: string,
static_handler: callable,
connections_override: dict = None,
port: int = 0
)
Parameters
| Name | Type | Description |
|---|---|---|
| host | string | The host address the server will bind to. |
| static_handler | callable | The handler class or function used for serving static files. |
| connections_override | dict = None | A dictionary of database connections to override in the thread. |
| port | int = 0 | The port number to bind to; defaults to 0 for an OS-assigned port. |
Methods
run()
@classmethod
def run()
Set up the live server and databases, and then loop over handling HTTP requests.
terminate()
@classmethod
def terminate()
Shuts down the HTTP server and joins the thread to ensure a clean exit.