🧪 Add comprehensive tests for src/tools.py#17
Conversation
This commit introduces a new test file `tests/test_tools.py` which provides unit tests for all functions in `src/tools.py`, including `build_tool_backlog`, `load_tool_snapshot`, `get_tool`, and others. Key improvements: - Verified `build_tool_backlog` returns correct `PortingBacklog` structure. - Added case-insensitive matching tests for `get_tool`. - Validated filtering logic in `get_tools` and `filter_tools_by_permission_context`. - Ensured `execute_tool` correctly handles both success and failure cases. - Added `.port_sessions/` to `.gitignore` to prevent local session logs from being committed. Test coverage: - 9 new unit tests covering 100% of the public functions in `src/tools.py`. - All 31 tests in the repository pass. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive test suite for tool-related functionality in tests/test_tools.py and updates the .gitignore to exclude session logs. Feedback focuses on removing several session log files that were accidentally committed to the .port_sessions/ directory and strengthening the simple_mode test case to ensure it does not pass on an empty result set.
There was a problem hiding this comment.
Pull request overview
Adds a new unittest suite to exercise the public API in src/tools.py, and updates ignore rules for locally persisted porting sessions.
Changes:
- Introduces
tests/test_tools.pywith unit tests covering snapshot loading, tool lookup/filtering, execution, and index rendering. - Adds
.port_sessions/to.gitignoreto avoid committing locally saved session artifacts. - Includes several
.port_sessions/*.jsonsession log files in the PR (these appear to be local artifacts).
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_tools.py | Adds unit tests for the src.tools API surface. |
| .gitignore | Ignores local .port_sessions/ directory. |
| .port_sessions/af1faf843fab41fbbfad064544248ef5.json | Adds a persisted session log file (likely unintended to commit). |
| .port_sessions/58914d03e535496e9da6b526139f7371.json | Adds a persisted session log file (likely unintended to commit). |
| .port_sessions/50ed5c42f34b48e0b5d11332cc3bd467.json | Adds a persisted session log file (likely unintended to commit). |
| .port_sessions/03690d189e3a47a7988752f670bee42e.json | Adds a persisted session log file (likely unintended to commit). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/badMade/claw-code/sessions/922dc5e4-e0f6-4994-b0c5-793204efbfb1 Co-authored-by: badMade <106821302+badMade@users.noreply.github.com>
|
@copilot code review |
|
@claude code review |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This commit introduces a new test file
tests/test_tools.pywhich provides unit tests for all functions insrc/tools.py, includingbuild_tool_backlog,load_tool_snapshot,get_tool, and others.Key improvements:
build_tool_backlogreturns correctPortingBacklogstructure.get_tool.get_toolsandfilter_tools_by_permission_context.execute_toolcorrectly handles both success and failure cases..port_sessions/to.gitignoreto prevent local session logs from being committed.Test coverage:
src/tools.py.