Skip to content

Commit 3b321ac

Browse files
speedstorm1copybara-github
authored andcommitted
chore: internal change
PiperOrigin-RevId: 956054191
1 parent 361292e commit 3b321ac

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

google/genai/tests/pytest_helper.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ def base_test_function(
7979
assert False, 'Should have raised exception in Vertex.'
8080
client._api_client.close()
8181
except Exception as e:
82+
# Gracefully skip the test if we hit a live API quota limit
83+
if getattr(e, 'code', None) == 429 and getattr(client._api_client, '_mode', None) == 'api':
84+
pytest.skip(
85+
'Resource Exhausted (429). Skipping test instead of'
86+
f' failing: {e}'
87+
)
88+
8289
if test_table_item.exception_if_mldev and not client._api_client.vertexai:
8390
if test_table_item.exception_if_mldev not in str(e):
8491
raise AssertionError(

google/genai/tests/shared/models/test_generate_videos.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@
2828
parameters=types._GenerateVideosParameters(
2929
model=VEO_MODEL_LATEST_VERTEX,
3030
prompt="Man with a dog",
31+
config=types.GenerateVideosConfig(
32+
http_options=types.HttpOptions(
33+
retry_options=types.HttpRetryOptions(
34+
attempts=2,
35+
initial_delay=10.0,
36+
http_status_codes=[429, 500, 502, 503, 504],
37+
),
38+
),
39+
),
3140
),
3241
exception_if_mldev=(
3342
"models/veo-3.1-lite-generate-001 is not found for API version v1beta"
@@ -38,6 +47,15 @@
3847
parameters=types._GenerateVideosParameters(
3948
model=VEO_MODEL_LATEST_GEMINI,
4049
prompt="Man with a dog",
50+
config=types.GenerateVideosConfig(
51+
http_options=types.HttpOptions(
52+
retry_options=types.HttpRetryOptions(
53+
attempts=2,
54+
initial_delay=10.0,
55+
http_status_codes=[429, 500, 502, 503, 504],
56+
),
57+
),
58+
),
4159
),
4260
exception_if_vertex=(
4361
"404 NOT_FOUND"

0 commit comments

Comments
 (0)