Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions google/genai/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,26 @@ def use_vertex():
return False


@pytest.fixture(autouse=True)
def skip_vertex_in_api_mode(request):
mode = request.config.getoption('--mode')
if mode == 'api' and not os.environ.get(
'GOOGLE_GENAI_RUN_VERTEX_IN_API_MODE'
):
if hasattr(request, 'node') and hasattr(request.node, 'callspec'):
if request.node.callspec.params.get('use_vertex') is True:
pytest.skip(
'Skipping Vertex AI tests in API mode (no GCP credentials'
' configured).'
)
elif 'use_vertex' in request.fixturenames:
if request.getfixturevalue('use_vertex') is True:
pytest.skip(
'Skipping Vertex AI tests in API mode (no GCP credentials'
' configured).'
)


# Overridden at the module level for each test file.
@pytest.fixture
def replays_prefix():
Expand Down
Loading