Skip to content

Commit b47bc10

Browse files
committed
fix tests
1 parent 863fbcf commit b47bc10

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

tests/test_litapi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def predict():
175175

176176

177177
def test_encode_response_with_custom_spec_api():
178-
class CustomSpecAPI(ls.test_examples.TestAPI):
178+
class CustomSpecAPI(ls.OpenAISpec):
179179
def encode_response(self, output_stream):
180180
for output in output_stream:
181181
yield {"content": output}

tests/test_specs.py

+5-9
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,11 @@ def encode_response(self, output):
176176

177177
@pytest.mark.asyncio
178178
async def test_openai_spec_validation(openai_request_data):
179-
server = ls.LitServer(IncorrectAPI1(), spec=OpenAISpec())
180-
with pytest.raises(ValueError, match="predict is not a generator"), wrap_litserve_start(server) as server:
181-
async with LifespanManager(server.app) as manager:
182-
await manager.shutdown()
183-
184-
server = ls.LitServer(IncorrectAPI2(), spec=OpenAISpec())
185-
with pytest.raises(ValueError, match="encode_response is not a generator"), wrap_litserve_start(server) as server:
186-
async with LifespanManager(server.app) as manager:
187-
await manager.shutdown()
179+
with pytest.raises(ValueError, match="predict is not a generator"):
180+
ls.LitServer(IncorrectAPI1(), spec=OpenAISpec())
181+
182+
with pytest.raises(ValueError, match="encode_response is not a generator"):
183+
ls.LitServer(IncorrectAPI2(), spec=OpenAISpec())
188184

189185

190186
class PrePopulatedAPI(ls.LitAPI):

0 commit comments

Comments
 (0)