Skip to content

Commit

Permalink
Added tool integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
antoninoLorenzo committed Jul 26, 2024
1 parent d8b43de commit 6b5f966
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Empty file.
26 changes: 26 additions & 0 deletions test/tool_integration/test_tool_integration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""
The tool documentations in `tools_settings` are LLM generated, to ensure
the correct JSON format is generated every time a new tool is added this
test verifies the tool can be correctly loaded.
> Discovering it when after building the Docker API is a pain in the ass
"""
import unittest
from pathlib import Path
from src.agent.tools.base import Tool


class TestToolIntegration(unittest.TestCase):
BASE_PATH = Path('../../tools_settings')

def test_load(self):
"""Try to load tool and fail if any exception is raised"""
try:
for path in Path(self.BASE_PATH).iterdir():
if path.is_file() and path.suffix == '.json':
Tool.load_tool(str(path))
except Exception as err:
self.fail(f'Tool Integration failed.\n{err}')


if __name__ == "__main__":
unittest.main()

0 comments on commit 6b5f966

Please sign in to comment.