Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 23, 2024
1 parent bb79eb1 commit 01f118b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/litserve/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def __init__(
"api_path must start with '/'. "
"Please provide a valid api path like '/predict', '/classify', or '/v1/predict'"
)

if not healthcheck_path.startswith("/"):
raise ValueError(
"healthcheck_path must start with '/'. "
Expand Down
1 change: 1 addition & 0 deletions tests/test_lit_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ def test_custom_api_path():
response = client.post(url, json={"input": 4.0})
assert response.status_code == 200, "Server response should be 200 (OK)"


def test_custom_healthcheck_path():
with pytest.raises(ValueError, match="healthcheck_path must start with '/'. "):
LitServer(ls.test_examples.SimpleLitAPI(), healthcheck_path="customhealth")
Expand Down
10 changes: 9 additions & 1 deletion tests/test_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,16 @@ def test_workers_health():
assert response.status_code == 200
assert response.text == "ok"


def test_workers_health_custom_path():
server = LitServer(SlowSetupLitAPI(), accelerator="cpu", healthcheck_path="/my_server/health", devices=1, timeout=5, workers_per_device=2)
server = LitServer(
SlowSetupLitAPI(),
accelerator="cpu",
healthcheck_path="/my_server/health",
devices=1,
timeout=5,
workers_per_device=2,
)

with wrap_litserve_start(server) as server, TestClient(server.app) as client:
response = client.get("/my_server/health")
Expand Down

0 comments on commit 01f118b

Please sign in to comment.