From f64543fe50b2799e9be9af6bad6ba18f656bfcc1 Mon Sep 17 00:00:00 2001 From: Ayush Agrawal Date: Wed, 22 Jul 2026 16:08:30 -0700 Subject: [PATCH] chore: internal change PiperOrigin-RevId: 952386766 --- google/genai/tests/pytest_helper.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/google/genai/tests/pytest_helper.py b/google/genai/tests/pytest_helper.py index 17076cd82..872991a5e 100644 --- a/google/genai/tests/pytest_helper.py +++ b/google/genai/tests/pytest_helper.py @@ -79,6 +79,13 @@ def base_test_function( assert False, 'Should have raised exception in Vertex.' client._api_client.close() except Exception as e: + # Gracefully skip the test if we hit a live API quota limit + if getattr(e, 'code', None) == 429 and client._api_client._mode == 'api': + pytest.skip( + 'Resource Exhausted (429). Skipping test instead of' + f' failing: {e}' + ) + if test_table_item.exception_if_mldev and not client._api_client.vertexai: if test_table_item.exception_if_mldev not in str(e): raise AssertionError(