From 5aca21005495ff095033a394f8bdc25ec06b4a17 Mon Sep 17 00:00:00 2001 From: Tim Conley Date: Wed, 5 Aug 2026 15:33:59 -0700 Subject: [PATCH] Test Strands with unique task queues --- tests/contrib/strands/test_hooks.py | 2 +- tests/contrib/strands/test_interrupt.py | 2 +- tests/contrib/strands/test_interrupt_exception.py | 4 ++-- tests/contrib/strands/test_invocation_state.py | 5 +++-- tests/contrib/strands/test_mcp.py | 8 ++++---- tests/contrib/strands/test_model.py | 2 +- tests/contrib/strands/test_model_streaming.py | 2 +- tests/contrib/strands/test_structured_output.py | 2 +- tests/contrib/strands/test_tool.py | 2 +- 9 files changed, 15 insertions(+), 14 deletions(-) diff --git a/tests/contrib/strands/test_hooks.py b/tests/contrib/strands/test_hooks.py index 19976cb44..7bcf0172f 100644 --- a/tests/contrib/strands/test_hooks.py +++ b/tests/contrib/strands/test_hooks.py @@ -67,7 +67,7 @@ async def run(self, prompt: str) -> list[str]: async def test_hooks(client: Client): _AUDIT_LOG.clear() - task_queue = "test_hooks" + task_queue = f"test_hooks-{uuid4()}" plugin = StrandsPlugin( models={ "mock": lambda: MockModel( diff --git a/tests/contrib/strands/test_interrupt.py b/tests/contrib/strands/test_interrupt.py index 64f72bc07..b5c76add0 100644 --- a/tests/contrib/strands/test_interrupt.py +++ b/tests/contrib/strands/test_interrupt.py @@ -65,7 +65,7 @@ async def run(self, prompt: str) -> str: async def test_interrupt(client: Client): - task_queue = "test_interrupt" + task_queue = f"test_interrupt-{uuid4()}" plugin = StrandsPlugin( models={ "mock": lambda: MockModel( diff --git a/tests/contrib/strands/test_interrupt_exception.py b/tests/contrib/strands/test_interrupt_exception.py index ed858b32b..e7492f286 100644 --- a/tests/contrib/strands/test_interrupt_exception.py +++ b/tests/contrib/strands/test_interrupt_exception.py @@ -99,7 +99,7 @@ async def run(self, prompt: str) -> str: async def test_in_workflow_tool_interrupt(client: Client): - task_queue = "test_in_workflow_tool_interrupt" + task_queue = f"test_in_workflow_tool_interrupt-{uuid4()}" plugin = StrandsPlugin( models={ "mock": lambda: MockModel( @@ -140,7 +140,7 @@ async def test_in_workflow_tool_interrupt(client: Client): async def test_activity_tool_interrupt(client: Client): global _activity_delete_calls _activity_delete_calls = 0 - task_queue = "test_activity_tool_interrupt" + task_queue = f"test_activity_tool_interrupt-{uuid4()}" plugin = StrandsPlugin( models={ "mock": lambda: MockModel( diff --git a/tests/contrib/strands/test_invocation_state.py b/tests/contrib/strands/test_invocation_state.py index 01fd4e004..84b5531a4 100644 --- a/tests/contrib/strands/test_invocation_state.py +++ b/tests/contrib/strands/test_invocation_state.py @@ -58,11 +58,12 @@ async def run(self, prompt: str) -> str: async def test_invocation_state_round_trip(client: Client): _RECEIVED.clear() + task_queue = f"test_invocation_state-{uuid4()}" plugin = StrandsPlugin(models={"recording": lambda: _RecordingModel()}) async with Worker( client, - task_queue="test_invocation_state", + task_queue=task_queue, workflows=[_InvocationStateWorkflow], plugins=[plugin], max_cached_workflows=0, @@ -71,7 +72,7 @@ async def test_invocation_state_round_trip(client: Client): _InvocationStateWorkflow.run, "hi", id=f"test_invocation_state_{uuid4()}", - task_queue="test_invocation_state", + task_queue=task_queue, ) # The serializable key crosses the activity boundary; the non-serializable diff --git a/tests/contrib/strands/test_mcp.py b/tests/contrib/strands/test_mcp.py index 0f989cd83..9849e6dda 100644 --- a/tests/contrib/strands/test_mcp.py +++ b/tests/contrib/strands/test_mcp.py @@ -52,7 +52,7 @@ async def run(self, prompt: str) -> str: async def test_mcp(client: Client): - task_queue = "test_mcp" + task_queue = f"test_mcp-{uuid4()}" plugin = StrandsPlugin( models={ "mock": lambda: MockModel( @@ -125,7 +125,7 @@ async def run(self, prompt: str) -> str: async def test_mcp_reuses_connection(client: Client): """Successive MCP tool calls reuse one cached worker-side connection.""" - task_queue = "test_mcp_reuses_connection" + task_queue = f"test_mcp_reuses_connection-{uuid4()}" # Count how often the worker opens a connection. One lazily-opened # connection serves the list-tools discovery and both tool calls (1); # reconnecting per call would make it more. @@ -206,7 +206,7 @@ async def run(self, prompt: str) -> str: async def test_mcp_connection_idle_timeout(client: Client): """A short idle timeout evicts the cached connection while the worker runs.""" - task_queue = "test_mcp_connection_idle_timeout" + task_queue = f"test_mcp_connection_idle_timeout-{uuid4()}" factory_calls = [0] def counting_factory() -> MCPClient: @@ -282,7 +282,7 @@ async def run(self, prompt: str) -> str: async def test_mcp_lists_tools_each_turn_when_uncached(client: Client): """With cache_tools=False the tool list is re-fetched on every model call.""" - task_queue = "test_mcp_lists_tools_each_turn_when_uncached" + task_queue = f"test_mcp_lists_tools_each_turn_when_uncached-{uuid4()}" plugin = StrandsPlugin( models={ "mock": lambda: MockModel( diff --git a/tests/contrib/strands/test_model.py b/tests/contrib/strands/test_model.py index 68d578e5c..c96d4c0d7 100644 --- a/tests/contrib/strands/test_model.py +++ b/tests/contrib/strands/test_model.py @@ -24,7 +24,7 @@ async def run(self, prompt: str) -> str: async def test_model(client: Client): - task_queue = "test_model" + task_queue = f"test_model-{uuid4()}" plugin = StrandsPlugin(models={"mock": lambda: MockModel(["Done!"])}) async with Worker( diff --git a/tests/contrib/strands/test_model_streaming.py b/tests/contrib/strands/test_model_streaming.py index 41f3ff2f1..1a0b84447 100644 --- a/tests/contrib/strands/test_model_streaming.py +++ b/tests/contrib/strands/test_model_streaming.py @@ -30,7 +30,7 @@ async def run(self, prompt: str) -> str: async def test_model_streaming(client: Client): - task_queue = "test_model_streaming" + task_queue = f"test_model_streaming-{uuid4()}" plugin = StrandsPlugin(models={"mock": lambda: MockModel(["Done!"])}) workflow_id = f"test_model_streaming_{uuid4()}" diff --git a/tests/contrib/strands/test_structured_output.py b/tests/contrib/strands/test_structured_output.py index 18c77c553..eafe2b364 100644 --- a/tests/contrib/strands/test_structured_output.py +++ b/tests/contrib/strands/test_structured_output.py @@ -33,7 +33,7 @@ async def run(self, prompt: str) -> PersonInfo: async def test_structured_output(client: Client): - task_queue = "test_structured_output" + task_queue = f"test_structured_output-{uuid4()}" plugin = StrandsPlugin( models={ "mock": lambda: MockModel( diff --git a/tests/contrib/strands/test_tool.py b/tests/contrib/strands/test_tool.py index 39985e2df..d13fcbec1 100644 --- a/tests/contrib/strands/test_tool.py +++ b/tests/contrib/strands/test_tool.py @@ -59,7 +59,7 @@ async def run(self, prompt: str) -> str: async def test_tool(client: Client, tmp_path: Path): - task_queue = "test_tool" + task_queue = f"test_tool-{uuid4()}" fixture = tmp_path / "greeting.txt" fixture.write_text("hello\n")