Skip to content

Commit a6552f5

Browse files
cleanup tests
1 parent 3b1c584 commit a6552f5

9 files changed

+8
-44
lines changed

tests/openai_agents/basic/test_agent_lifecycle_workflow.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import uuid
22
from concurrent.futures import ThreadPoolExecutor
33

4-
import pytest
54
from temporalio.client import Client
65
from temporalio.worker import Worker
76

@@ -18,7 +17,6 @@ async def test_execute_workflow(client: Client):
1817
task_queue=task_queue_name,
1918
workflows=[AgentLifecycleWorkflow],
2019
activity_executor=ThreadPoolExecutor(5),
21-
# No external activities needed - workflow uses function tools
2220
):
2321
result = await client.execute_workflow(
2422
AgentLifecycleWorkflow.run,
@@ -28,7 +26,6 @@ async def test_execute_workflow(client: Client):
2826
)
2927

3028
# Verify the result has the expected structure
31-
assert hasattr(result, "number")
3229
assert isinstance(result.number, int)
3330
assert (
3431
0 <= result.number <= 20

tests/openai_agents/basic/test_dynamic_system_prompt_workflow.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import uuid
22
from concurrent.futures import ThreadPoolExecutor
33

4-
import pytest
54
from temporalio.client import Client
65
from temporalio.worker import Worker
76

@@ -18,7 +17,6 @@ async def test_execute_workflow_with_random_style(client: Client):
1817
task_queue=task_queue_name,
1918
workflows=[DynamicSystemPromptWorkflow],
2019
activity_executor=ThreadPoolExecutor(5),
21-
# No external activities needed
2220
):
2321
result = await client.execute_workflow(
2422
DynamicSystemPromptWorkflow.run,
@@ -41,7 +39,6 @@ async def test_execute_workflow_with_specific_style(client: Client):
4139
task_queue=task_queue_name,
4240
workflows=[DynamicSystemPromptWorkflow],
4341
activity_executor=ThreadPoolExecutor(5),
44-
# No external activities needed
4542
):
4643
result = await client.execute_workflow(
4744
DynamicSystemPromptWorkflow.run,
Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
import uuid
22
from concurrent.futures import ThreadPoolExecutor
33

4-
import pytest
5-
from temporalio import activity
64
from temporalio.client import Client
75
from temporalio.worker import Worker
86

9-
from openai_agents.basic.activities.get_weather_activity import get_weather
10-
from openai_agents.basic.activities.image_activities import read_image_as_base64
11-
from openai_agents.basic.activities.math_activities import (
12-
multiply_by_two,
13-
random_number,
14-
)
157
from openai_agents.basic.workflows.hello_world_workflow import HelloWorldAgent
168

179

@@ -23,16 +15,12 @@ async def test_execute_workflow(client: Client):
2315
task_queue=task_queue_name,
2416
workflows=[HelloWorldAgent],
2517
activity_executor=ThreadPoolExecutor(5),
26-
activities=[
27-
get_weather,
28-
multiply_by_two,
29-
random_number,
30-
read_image_as_base64,
31-
],
3218
):
33-
await client.execute_workflow(
19+
result = await client.execute_workflow(
3420
HelloWorldAgent.run,
3521
"Write a recursive haiku about recursive haikus.",
3622
id=str(uuid.uuid4()),
3723
task_queue=task_queue_name,
3824
)
25+
assert isinstance(result, str)
26+
assert len(result) > 0

tests/openai_agents/basic/test_lifecycle_workflow.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import uuid
22
from concurrent.futures import ThreadPoolExecutor
33

4-
import pytest
54
from temporalio.client import Client
65
from temporalio.worker import Worker
76

@@ -16,7 +15,6 @@ async def test_execute_workflow(client: Client):
1615
task_queue=task_queue_name,
1716
workflows=[LifecycleWorkflow],
1817
activity_executor=ThreadPoolExecutor(5),
19-
# No external activities needed - workflow uses function tools
2018
):
2119
result = await client.execute_workflow(
2220
LifecycleWorkflow.run,
@@ -26,7 +24,6 @@ async def test_execute_workflow(client: Client):
2624
)
2725

2826
# Verify the result has the expected structure
29-
assert hasattr(result, "number")
3027
assert isinstance(result.number, int)
3128
assert (
3229
0 <= result.number <= 20

tests/openai_agents/basic/test_local_image_workflow.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import uuid
22
from concurrent.futures import ThreadPoolExecutor
33

4-
import pytest
54
from temporalio.client import Client
65
from temporalio.worker import Worker
76

tests/openai_agents/basic/test_non_strict_output_workflow.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import uuid
22
from concurrent.futures import ThreadPoolExecutor
33

4-
import pytest
54
from temporalio.client import Client
65
from temporalio.worker import Worker
76

@@ -30,17 +29,14 @@ async def test_execute_workflow(client: Client):
3029
# Verify the result has the expected structure
3130
assert isinstance(result, dict)
3231

33-
# Should have either strict_result or strict_error
34-
assert "strict_result" in result or "strict_error" in result
35-
36-
# Should have either non_strict_result or non_strict_error
37-
assert "non_strict_result" in result or "non_strict_error" in result
32+
assert "strict_error" in result
33+
assert "non_strict_result" in result
3834

3935
# If there's a strict_error, it should be a string
4036
if "strict_error" in result:
4137
assert isinstance(result["strict_error"], str)
4238
assert len(result["strict_error"]) > 0
4339

44-
# If there's a non_strict_result, verify it's valid
45-
if "non_strict_result" in result:
46-
assert result["non_strict_result"] is not None
40+
jokes = result["non_strict_result"]["jokes"]
41+
assert isinstance(jokes, dict)
42+
assert isinstance(jokes[list(jokes.keys())[0]], str)

tests/openai_agents/basic/test_previous_response_id_workflow.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import uuid
22
from concurrent.futures import ThreadPoolExecutor
33

4-
import pytest
54
from temporalio.client import Client
65
from temporalio.worker import Worker
76

@@ -18,7 +17,6 @@ async def test_execute_workflow(client: Client):
1817
task_queue=task_queue_name,
1918
workflows=[PreviousResponseIdWorkflow],
2019
activity_executor=ThreadPoolExecutor(5),
21-
# No external activities needed
2220
):
2321
first_question = "What is the capital of France?"
2422
follow_up_question = "What is the population of that city?"

tests/openai_agents/basic/test_remote_image_workflow.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import uuid
22
from concurrent.futures import ThreadPoolExecutor
33

4-
import pytest
54
from temporalio.client import Client
65
from temporalio.worker import Worker
76

87
from openai_agents.basic.workflows.remote_image_workflow import RemoteImageWorkflow
98

109

11-
# TODO(@donald-pinckney): debug this test
1210
async def test_execute_workflow_default_question(client: Client):
1311
task_queue_name = str(uuid.uuid4())
1412

@@ -17,9 +15,7 @@ async def test_execute_workflow_default_question(client: Client):
1715
task_queue=task_queue_name,
1816
workflows=[RemoteImageWorkflow],
1917
activity_executor=ThreadPoolExecutor(5),
20-
# No external activities needed - uses remote URL directly
2118
):
22-
# Using a reliable test image URL
2319
test_image_url = "https://upload.wikimedia.org/wikipedia/commons/0/0c/GoldenGateBridge-001.jpg"
2420

2521
result = await client.execute_workflow(
@@ -34,7 +30,6 @@ async def test_execute_workflow_default_question(client: Client):
3430
assert len(result) > 0
3531

3632

37-
# TODO(@donald-pinckney): debug this test
3833
async def test_execute_workflow_custom_question(client: Client):
3934
task_queue_name = str(uuid.uuid4())
4035

@@ -43,9 +38,7 @@ async def test_execute_workflow_custom_question(client: Client):
4338
task_queue=task_queue_name,
4439
workflows=[RemoteImageWorkflow],
4540
activity_executor=ThreadPoolExecutor(5),
46-
# No external activities needed - uses remote URL directly
4741
):
48-
# Using a reliable test image URL
4942
test_image_url = "https://upload.wikimedia.org/wikipedia/commons/0/0c/GoldenGateBridge-001.jpg"
5043
custom_question = "What do you see in this image?"
5144

tests/openai_agents/basic/test_tools_workflow.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import uuid
22
from concurrent.futures import ThreadPoolExecutor
33

4-
import pytest
54
from temporalio.client import Client
65
from temporalio.worker import Worker
76

0 commit comments

Comments
 (0)