Skip to main content

LiveServerThread

Thread for running a live HTTP server while the tests are running.

Attributes

AttributeTypeDescription
server_classclass = ThreadedWSGIServerThe 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

NameTypeDescription
hoststringThe host address the server will bind to.
static_handlercallableThe handler class or function used for serving static files.
connections_overridedict = NoneA dictionary of database connections to override in the thread.
portint = 0The 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.