poorconn.pytest_plugin.poorconn_http_server¶
-
poorconn.pytest_plugin.
poorconn_http_server
(tmp_path, request)¶ A
pytest
fixture: Anhttp.server.HTTPServer
object that serves on a new thread. By default, it listens onlocalhost:8080
. It’s socket is slowed down withpoorconn.delay_before_sending()
. It servestmp_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:address
: The address to bind the HTTP server.port
: The port that the HTTP server listens on.t
: Same ast
inpoorconn.delay_before_sending()
.length
: Same aslength
inpoorconn.delay_before_sending()
.
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]