Skip to content

Commit 5f9f1bb

Browse files
committed
test: fix tests after adding supports_hot_reload property to PythonAgentTool
- Update test_supports_hot_reload to expect True (PythonAgentTool now supports hot reload) - Fix test_register_tool_duplicate_name_without_hot_reload to use mocked tools without hot reload support - Add missing patch import in test_registry.py
1 parent 9815fb9 commit 5f9f1bb

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

tests/strands/tools/test_registry.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,16 @@ def function() -> str:
124124

125125
def test_register_tool_duplicate_name_without_hot_reload():
126126
"""Test that registering a tool with duplicate name raises ValueError when hot reload is not supported."""
127-
tool_1 = PythonAgentTool(tool_name="duplicate_tool", tool_spec=MagicMock(), tool_func=lambda: None)
128-
tool_2 = PythonAgentTool(tool_name="duplicate_tool", tool_spec=MagicMock(), tool_func=lambda: None)
127+
# Create mock tools that don't support hot reload
128+
tool_1 = MagicMock()
129+
tool_1.tool_name = "duplicate_tool"
130+
tool_1.supports_hot_reload = False
131+
tool_1.is_dynamic = False
132+
133+
tool_2 = MagicMock()
134+
tool_2.tool_name = "duplicate_tool"
135+
tool_2.supports_hot_reload = False
136+
tool_2.is_dynamic = False
129137

130138
tool_registry = ToolRegistry()
131139
tool_registry.register_tool(tool_1)

tests/strands/tools/test_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ def test_tool_type(identity_tool):
487487

488488
@pytest.mark.parametrize("identity_tool", ["identity_invoke", "identity_invoke_async"], indirect=True)
489489
def test_supports_hot_reload(identity_tool):
490-
assert not identity_tool.supports_hot_reload
490+
assert identity_tool.supports_hot_reload
491491

492492

493493
@pytest.mark.parametrize("identity_tool", ["identity_invoke", "identity_invoke_async"], indirect=True)

0 commit comments

Comments
 (0)