Skip to content

Commit

Permalink
review changes to tests
Browse files Browse the repository at this point in the history
Signed-off-by: technillogue <[email protected]>
  • Loading branch information
technillogue committed Nov 6, 2023
1 parent a1f92b3 commit dfe6361
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 3 additions & 4 deletions python/tests/server/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,6 @@ def test_prediction_idempotent_endpoint_conflict(client, match):
json={"input": {"sleep": 1}},
headers={"Prefer": "respond-async"},
)
time.sleep(0.001)
resp2 = client.put(
"/predictions/5678efgh",
json={"input": {"sleep": 1}},
Expand Down Expand Up @@ -518,12 +517,12 @@ def test_prediction_cancel(client):
)
assert resp.status_code == 202

resp = client.post("/predictions/123/cancel")
assert resp.status_code == 200

resp = client.post("/predictions/456/cancel")
assert resp.status_code == 404

resp = client.post("/predictions/123/cancel")
assert resp.status_code == 200


@uses_predictor_with_client_options(
"setup_weights",
Expand Down
5 changes: 3 additions & 2 deletions python/tests/server/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ async def test_prediction_runner_called_while_busy(runner):

assert runner.is_busy()
with pytest.raises(RunnerBusyError):
await runner.predict(request)[1]
_, task = runner.predict(request)
await task

# Await to ensure that the first prediction is scheduled before we
# attempt to shut down the runner.
Expand All @@ -90,7 +91,7 @@ async def test_prediction_runner_called_while_busy_idempotent(runner):
runner.predict(request)
_, async_result = runner.predict(request)

response = await async_result
response = await asyncio.wait_for(async_result, timeout=1)
assert response.id == "abcd1234"
assert response.output == "done in 0.1 seconds"
assert response.status == "succeeded"
Expand Down

0 comments on commit dfe6361

Please sign in to comment.