Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sweep: Add tests for context agent (#3646)
# Description This pull request introduces a significant enhancement to the `sweepai` project by adding unit tests for the context pruning functionality and refactoring the `ripgrep` command execution into a separate function. These changes aim to improve the maintainability and testability of the codebase, ensuring that the context pruning logic works as expected and can be easily extended in the future. # Summary - Refactored the execution of the `ripgrep` command into a new function `run_ripgrep_command` in `sweepai/core/context_pruning.py` to streamline the process of searching code entities within a repository. - Added a comprehensive suite of unit tests in `tests/test_context_pruning.py` covering key functionalities such as building the full hierarchy of files, loading a graph from a file, and retrieving relevant context based on a query. These tests ensure the robustness and reliability of the context pruning feature. - Enhanced code readability and maintainability by removing duplicated `ripgrep` command execution logic and centralizing it into a single, reusable function. - The new tests contribute to a safer development environment, allowing for future changes to be made with confidence that the core functionality remains unaffected. Fixes #3493. --- <details> <summary><b>🎉 Latest improvements to Sweep:</b></summary> <ul> <li>New <a href="https://sweep-trilogy.vercel.app">dashboard</a> launched for real-time tracking of Sweep issues, covering all stages from search to coding.</li> <li>Integration of OpenAI's latest Assistant API for more efficient and reliable code planning and editing, improving speed by 3x.</li> <li>Use the <a href="https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-pull-request-github">GitHub issues extension</a> for creating Sweep issues directly from your editor.</li> </ul> </details> --- ### 💡 To get Sweep to edit this pull request, you can: * Comment below, and Sweep can edit the entire PR * Comment on a file, Sweep will only modify the commented file * Edit the original issue to get Sweep to recreate the PR from scratch *This is an automated message generated by [Sweep AI](https://sweep.dev).*
- Loading branch information