File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,23 +56,22 @@ def use_vertex():
5656
5757
5858@pytest .fixture (autouse = True )
59- def skip_vertex_in_api_mode (request ):
59+ def skip_based_on_api_mode_env_vars (request ):
6060 mode = request .config .getoption ('--mode' )
61- if mode == 'api' and not os .environ .get (
62- 'GOOGLE_GENAI_RUN_VERTEX_IN_API_MODE'
63- ):
61+ if mode == 'api' :
62+ use_vertex = None
6463 if hasattr (request , 'node' ) and hasattr (request .node , 'callspec' ):
65- if request .node .callspec .params .get ('use_vertex' ) is True :
66- pytest .skip (
67- 'Skipping Vertex AI tests in API mode (no GCP credentials'
68- ' configured).'
69- )
64+ use_vertex = request .node .callspec .params .get ('use_vertex' )
7065 elif 'use_vertex' in request .fixturenames :
71- if request .getfixturevalue ('use_vertex' ) is True :
72- pytest .skip (
73- 'Skipping Vertex AI tests in API mode (no GCP credentials'
74- ' configured).'
75- )
66+ use_vertex = request .getfixturevalue ('use_vertex' )
67+
68+ run_vertex_only = os .environ .get ('GOOGLE_GENAI_RUN_VERTEX_ONLY_IN_API_MODE' )
69+ run_gemini_only = os .environ .get ('GOOGLE_GENAI_RUN_GEMINI_ONLY_IN_API_MODE' )
70+
71+ if use_vertex is True and run_gemini_only :
72+ pytest .skip ('Skipping Vertex AI tests in API mode (GEMINI ONLY config enabled).' )
73+ elif use_vertex is False and run_vertex_only :
74+ pytest .skip ('Skipping Gemini API tests in API mode (VERTEX ONLY config enabled).' )
7675
7776
7877# Overridden at the module level for each test file.
You can’t perform that action at this time.
0 commit comments