poorconn.pytest_plugin.poorconn_http_server

poorconn.pytest_plugin.poorconn_http_server(tmp_path, request)

A pytest fixture: An http.server.HTTPServer object that serves on a new thread. By default, it listens on localhost:8080. It’s socket is slowed down with poorconn.delay_before_sending(). It serves tmp_path as the root directory.

The defaults can be modified by applying the @pytest.mark.poorconn_http_server_config marker. The marker accepts the following parameters:

Example:

@pytest.mark.poorconn_http_server_config(address='127.0.0.1', port=2222, t=2, length=1024)
def test_http_server(poorconn_http_server, tmp_path):
    "My test..."
Parameters
  • tmp_path (pathlib.Path) –

  • request (_pytest.fixtures.FixtureRequest) –

Return type

Iterator[poorconn.pytest_plugin._impl.Server]