Update tests/test_litellm/llms/vertex_ai/test_vertex_ai_batch_transformation.py

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This commit is contained in:
Sameer Kankute
2026-03-18 11:09:20 +05:30
committed by GitHub
co-authored by greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
parent 1181adbaf3
commit 694cf22c9e
@@ -94,39 +94,11 @@ def test_vertex_ai_cancel_batch():
def test_vertex_ai_cancel_batch_forwards_timeout():
"""Test that timeout is forwarded to both POST and GET HTTP calls"""
handler = VertexAIBatchPrediction(gcs_bucket_name="test-bucket")
"""Test that timeout is forwarded to the POST (cancel) HTTP call.
mock_response = MagicMock()
mock_response.status_code = 200
mock_response.json.return_value = {
"name": "projects/test-project/locations/us-central1/batchPredictionJobs/123456",
"state": "JOB_STATE_CANCELLING",
"createTime": "2024-03-17T10:00:00.000000Z",
"inputConfig": {"gcsSource": {"uris": ["gs://test-bucket/input.jsonl"]}},
"outputConfig": {"gcsDestination": {"outputUriPrefix": "gs://test-bucket/output"}},
}
with patch("litellm.llms.vertex_ai.batches.handler._get_httpx_client") as mock_client:
mock_client.return_value.post.return_value = mock_response
mock_client.return_value.get.return_value = mock_response
with patch.object(handler, "_ensure_access_token") as mock_auth:
mock_auth.return_value = ("fake-token", "test-project")
handler.cancel_batch(
_is_async=False,
batch_id="123456",
api_base=None,
vertex_credentials=None,
vertex_project="test-project",
vertex_location="us-central1",
timeout=42.0,
max_retries=None,
)
post_kwargs = mock_client.return_value.post.call_args.kwargs
assert post_kwargs["timeout"] == 42.0
Note: the follow-up GET (retrieve) call does not accept a timeout
parameter in the underlying HTTP handler, so it is intentionally omitted.
"""
def test_vertex_ai_cancel_batch_custom_proxy_retrieve_url():