Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
aniketmaurya committed Nov 7, 2024
1 parent 6a6596f commit 34c91dd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_lit_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,3 +392,15 @@ def test_generate_client_file(tmp_path, monkeypatch):
LitServer.generate_client_file(8000)
with open(tmp_path / "client.py") as fr:
assert expected in fr.read(), "Shouldn't replace existing client.py"


class FailFastAPI(ls.test_examples.SimpleLitAPI):
def setup(self, device):
raise ValueError("setup failed")


def test_workers_setup_status():
api = FailFastAPI()
server = LitServer(api, devices=1)
with pytest.raises(RuntimeError, match="One or more workers failed to start. Shutting down LitServe"):
server.run()

0 comments on commit 34c91dd

Please sign in to comment.