Verify a tool can be called and returns a result.
(tool_manager_sqlite)
| 33 | @pytest.mark.integration |
| 34 | @pytest.mark.asyncio |
| 35 | async def test_tool_execution(tool_manager_sqlite): |
| 36 | """Verify a tool can be called and returns a result.""" |
| 37 | tm = tool_manager_sqlite |
| 38 | |
| 39 | # Find a tool to call (sqlite usually has list_tables or read_query) |
| 40 | tools = await tm.get_unique_tools() |
| 41 | tool_names = [t.name for t in tools] |
| 42 | |
| 43 | # Try common sqlite tool names |
| 44 | target = None |
| 45 | for candidate in ("list_tables", "list-tables", "read_query", "read-query"): |
| 46 | if candidate in tool_names: |
| 47 | target = candidate |
| 48 | break |
| 49 | |
| 50 | if target is None: |
| 51 | pytest.skip(f"No known sqlite tool found in: {tool_names[:10]}") |
| 52 | |
| 53 | # Execute the tool |
| 54 | result = await tm.execute_tool(target, {}) |
| 55 | assert result.success, f"Tool {target} failed: {result.error}" |
| 56 | assert result.result is not None |
| 57 | |
| 58 | |
| 59 | @pytest.mark.integration |
nothing calls this directly
no test coverage detected