Skip to content
Merged
Show file tree
Hide file tree
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
34 changes: 7 additions & 27 deletions tests/contrib/google_genai/test_gemini.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,13 @@ class RegisterFilesWorkflow:

@workflow.run
async def run(self, uris: list[str]) -> str:
client = TemporalAsyncClient()
# Missing credentials is a permanent error; retrying only delays it.
client = TemporalAsyncClient(
activity_config=ActivityConfig(
start_to_close_timeout=timedelta(seconds=60),
retry_policy=RetryPolicy(maximum_attempts=1),
)
)
# auth arg is ignored by TemporalAsyncFiles — the activity uses
# credentials from GoogleGenAIPlugin init. We pass a dummy here;
# can't import google.auth.credentials in the sandbox so we
Expand Down Expand Up @@ -901,7 +907,6 @@ async def test_simple_generate_content(client: Client):
"Say hello",
id=f"gemini-simple-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=10),
)

assert result == "Hello from Gemini!"
Expand All @@ -928,7 +933,6 @@ async def test_tool_call_single_arg(client: Client):
"What's the weather in Tokyo?",
id=f"gemini-tool-single-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=10),
)

assert tool_tracker.calls == [("get_weather", {"city": "Tokyo"})]
Expand Down Expand Up @@ -958,7 +962,6 @@ async def test_tool_call_multi_arg(client: Client):
"What's the weather in Paris, France?",
id=f"gemini-tool-multi-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=10),
)

assert tool_tracker.calls == [
Expand Down Expand Up @@ -988,7 +991,6 @@ async def test_tool_failure_propagation(client: Client):
"Weather in Nowhere?",
id=f"gemini-tool-fail-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=10),
)

assert tool_tracker.calls == [("get_weather_failure", {"city": "Nowhere"})]
Expand Down Expand Up @@ -1021,7 +1023,6 @@ async def test_multiple_tools_sequential(client: Client):
"Compare Tokyo and Paris weather",
id=f"gemini-multi-tools-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=15),
)

assert tool_tracker.calls == [
Expand All @@ -1047,7 +1048,6 @@ async def test_workflow_method_as_tool(client: Client):
"Tell me about Berlin",
id=f"gemini-wf-method-tool-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=10),
)
result = await handle.result()
# Query must happen while worker is alive
Expand All @@ -1069,7 +1069,6 @@ async def test_streamed_generate_content(client: Client):
"Say something",
id=f"gemini-streamed-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=10),
)

# The tracker splits the text into per-word chunks
Expand All @@ -1092,7 +1091,6 @@ async def test_http_options_headers_propagate(client: Client):
args=["hi", {"headers": {"X-Custom": "test-value"}}],
id=f"gemini-http-headers-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=10),
)

assert len(api_tracker.requests) == 1
Expand All @@ -1111,7 +1109,6 @@ async def test_http_options_api_version_propagates(client: Client):
args=["hi", {"api_version": "v1"}],
id=f"gemini-http-version-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=10),
)

assert len(api_tracker.requests) == 1
Expand All @@ -1130,7 +1127,6 @@ async def test_http_options_base_url_propagates(client: Client):
args=["hi", {"base_url": "https://custom.example.com"}],
id=f"gemini-http-base-url-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=10),
)

assert len(api_tracker.requests) == 1
Expand All @@ -1156,7 +1152,6 @@ async def test_http_options_multiple_fields_propagate(client: Client):
],
id=f"gemini-http-multi-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=10),
)

assert len(api_tracker.requests) == 1
Expand All @@ -1177,7 +1172,6 @@ async def test_no_http_options_passes_none(client: Client):
"hi",
id=f"gemini-http-none-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=10),
)

assert len(api_tracker.requests) == 1
Expand All @@ -1199,7 +1193,6 @@ async def test_file_upload_str_path(client: Client):
"/tmp/test.txt",
id=f"gemini-file-upload-str-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=10),
)

assert len(api_tracker.file_upload_requests) == 1
Expand All @@ -1221,7 +1214,6 @@ async def test_file_upload_bytes(client: Client):
b"hello world",
id=f"gemini-file-upload-bytes-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=10),
)

assert len(api_tracker.file_upload_requests) == 1
Expand All @@ -1243,7 +1235,6 @@ async def test_file_download(client: Client):
"files/some-file",
id=f"gemini-file-download-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=10),
)

assert len(api_tracker.file_download_requests) == 1
Expand All @@ -1266,7 +1257,6 @@ async def test_file_search_store_upload(client: Client):
args=["fileSearchStores/my-store", "/tmp/doc.txt"],
id=f"gemini-fss-upload-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=10),
)

assert len(api_tracker.file_search_store_upload_requests) == 1
Expand Down Expand Up @@ -1299,7 +1289,6 @@ async def test_chat_multi_turn(client: Client):
"Hello",
id=f"gemini-chat-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=10),
)

assert len(api_tracker.requests) == 2
Expand Down Expand Up @@ -1448,7 +1437,6 @@ async def test_full_integration_with_mock_client(client: Client):
"test prompt",
id=f"gemini-full-integration-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=15),
)

assert result["generate"] == "Real activity response"
Expand Down Expand Up @@ -1482,7 +1470,6 @@ async def test_register_files_without_credentials_fails(client: Client):
["gs://bucket/file.txt"],
id=f"gemini-register-no-creds-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=10),
)

# The error is nested: WorkflowFailureError → ActivityError → ApplicationError
Expand Down Expand Up @@ -1737,7 +1724,6 @@ async def test_interaction_create(client: Client):
"What's an interaction?",
id=f"gemini-interaction-create-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=10),
)

assert result == {"id": INTERACTION_ID, "status": "completed"}
Expand All @@ -1760,7 +1746,6 @@ async def test_interaction_create_stream(client: Client):
"Stream me",
id=f"gemini-interaction-stream-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=10),
)

assert result == [
Expand All @@ -1783,7 +1768,6 @@ async def test_interaction_lifecycle(client: Client):
"interactions/abc",
id=f"gemini-interaction-lifecycle-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=10),
)

assert result["got_id"] == INTERACTION_ID
Expand All @@ -1801,7 +1785,6 @@ async def test_agents_crud(client: Client):
AgentsWorkflow.run,
id=f"gemini-agents-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=10),
)

assert result["created_id"] == "test-agent"
Expand All @@ -1825,7 +1808,6 @@ async def test_webhooks_unsupported(client: Client):
WebhooksUnsupportedWorkflow.run,
id=f"gemini-webhooks-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=10),
)

assert "client.webhooks is not supported in Temporal workflows" in result
Expand Down Expand Up @@ -1949,7 +1931,6 @@ async def test_replay_simple_generate(client: Client):
"Say hello",
id=f"gemini-replay-simple-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=10),
)
await handle.result()
history = await handle.fetch_history()
Expand Down Expand Up @@ -2034,7 +2015,6 @@ async def test_side_effects_activity_scheduling(client: Client):
"Compare Tokyo and Paris weather",
id=f"gemini-side-effects-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=15),
)
await handle.result()

Expand Down
6 changes: 0 additions & 6 deletions tests/contrib/google_genai/test_gemini_mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ async def test_mcp_tool_discovery_and_call(client: Client):
args=[server, "echo hello"],
id=f"gemini-mcp-{uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=30),
)
result = await handle.result()
names = await _activity_names(handle)
Expand Down Expand Up @@ -227,7 +226,6 @@ async def test_mcp_connection_pooling(client: Client):
args=[server, "echo twice"],
id=f"gemini-mcp-pool-{uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=30),
)
assert await handle.result() == "Done!"
names = await _activity_names(handle)
Expand Down Expand Up @@ -255,7 +253,6 @@ async def test_mcp_full_schema_propagation(client: Client):
args=[server, "echo hi"],
id=f"gemini-mcp-schema-{uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=30),
)

# The first generate request carries the tool declarations the SDK built
Expand Down Expand Up @@ -285,7 +282,6 @@ async def test_mcp_replay(client: Client):
args=[server, "echo hello"],
id=f"gemini-mcp-replay-{uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=30),
)
await handle.result()
history = await handle.fetch_history()
Expand Down Expand Up @@ -316,7 +312,6 @@ async def test_mcp_side_effects(client: Client):
args=[server, "echo hello"],
id=f"gemini-mcp-side-effects-{uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=30),
)
await handle.result()
names = await _activity_names(handle)
Expand Down Expand Up @@ -356,7 +351,6 @@ async def test_mcp_via_gemini_test_server(client: Client):
args=[server, "echo the phrase: durable execution"],
id=f"gemini-mcp-public-{uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=30),
)
result = await handle.result()
names = await _activity_names(handle)
Expand Down
2 changes: 0 additions & 2 deletions tests/contrib/google_genai/test_gemini_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ async def test_streaming_publishes_to_workflow_stream(client: Client):
"say hi",
id=wf_id,
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=15),
)

stream = WorkflowStreamClient.create(new_client, wf_id)
Expand Down Expand Up @@ -116,7 +115,6 @@ async def test_streaming_without_workflow_stream_raises(client: Client):
"hi",
id=f"gemini-stream-nostream-{uuid.uuid4()}",
task_queue=worker.task_queue,
execution_timeout=timedelta(seconds=10),
)

assert "WorkflowStream" in str(exc_info.value.cause)
Loading
Loading