Skip to content

Commit fa19c53

Browse files
jaycee-licopybara-github
authored andcommitted
chore: Update shared API tests
PiperOrigin-RevId: 930107901
1 parent ca97c58 commit fa19c53

7 files changed

Lines changed: 19 additions & 8 deletions

File tree

google/genai/tests/conftest.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ def replays_prefix():
6161
return 'test'
6262

6363

64+
# Overridden at the module level for each test file.
65+
@pytest.fixture
66+
def location():
67+
return None
68+
69+
6470
def _get_replay_id(use_vertex: bool, replays_prefix: str) -> str:
6571
test_name_ending = os.environ.get('PYTEST_CURRENT_TEST').split('::')[-1]
6672
test_name = (
@@ -72,7 +78,7 @@ def _get_replay_id(use_vertex: bool, replays_prefix: str) -> str:
7278

7379

7480
@pytest.fixture
75-
def client(use_vertex, replays_prefix, http_options, request):
81+
def client(use_vertex, replays_prefix, http_options, location, request):
7682
mode = request.config.getoption('--mode')
7783
if mode not in ['auto', 'record', 'replay', 'api', 'tap']:
7884
raise ValueError('Invalid mode: ' + mode)
@@ -121,6 +127,7 @@ def client(use_vertex, replays_prefix, http_options, request):
121127
vertexai=use_vertex,
122128
http_options=http_options,
123129
private=private,
130+
location=location,
124131
)
125132

126133
with mock.patch.object(

google/genai/tests/pytest_helper.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ def setup(
143143
test_method: Optional[str] = None,
144144
test_table: Optional[list[TestTableItem]] = None,
145145
http_options: Optional[HttpOptions] = None,
146+
location: Optional[str] = None,
146147
):
147148
"""Generates parameterization for tests, run for both Vertex and MLDev."""
148149
replays_directory = (
@@ -192,10 +193,10 @@ def setup(
192193

193194
# Add fixture for requested client option.
194195
return pytest.mark.parametrize(
195-
'use_vertex, replays_prefix, http_options',
196+
'use_vertex, replays_prefix, http_options, location',
196197
[
197-
(True, replays_directory, http_options),
198-
(False, replays_directory, http_options),
198+
(True, replays_directory, http_options, location),
199+
(False, replays_directory, http_options, location),
199200
],
200201
)
201202

google/genai/tests/shared/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# limitations under the License.
1414
#
1515

16-
GEMINI_MODEL = 'gemini-3.1-pro-preview' # Gemini only
16+
GEMINI_MODEL = 'gemini-3.5-flash' # Gemini only

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
pytest_helper.TestTableItem(
3535
name='test_embed_gemini_embedding_2',
3636
parameters=genai_types.EmbedContentParameters(
37-
model='gemini-embedding-2-preview',
37+
model='gemini-embedding-2',
3838
contents='Hello world!',
3939
config={
4040
'output_dimensionality': 10,

google/genai/tests/shared/tunings/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,4 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
# GEMINI_TUNABLE_MODEL = 'gemini-3.1-flash-lite'
15-
GEMINI_TUNABLE_MODEL = 'gemini-2.5-pro'
14+
GEMINI_TUNABLE_MODEL = 'gemini-3.5-flash'

google/genai/tests/shared/tunings/test_create.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
globals_for_file=globals(),
4444
test_method='tunings.tune',
4545
test_table=test_table,
46+
# Ignore the env var and always set the location to us-central1
47+
location='us-central1',
4648
)
4749

4850
pytest_plugins = ('pytest_asyncio',)

google/genai/tests/shared/tunings/test_create_get_cancel.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ def create_get_cancel(client, parameters):
5454
globals_for_file=globals(),
5555
test_method="create_get_cancel",
5656
test_table=test_table,
57+
# Ignore the env var and always set the location to us-central1
58+
location="us-central1",
5759
)
5860

5961
pytest_plugins = ("pytest_asyncio",)

0 commit comments

Comments
 (0)