This pull request introduces a new utility function to capture pytest output and refactors the existing code to use this function. The most significant changes include importing the new utility function, modifying the test-running logic, and adding the new function.
Refactoring and new utility function:
src/agent/tools.py: Imported run_pytest_and_capture_output from agent.utils and replaced the existing test-running logic with a call to this new function in run_tests. [1][2]
src/agent/utils.py: Added the run_pytest_and_capture_output function to capture pytest output using redirect_stdout and StringIO.
This pull request introduces a new utility function to capture pytest output and refactors the existing code to use this function. The most significant changes include importing the new utility function, modifying the test-running logic, and adding the new function.
Refactoring and new utility function:
src/agent/tools.py
: Importedrun_pytest_and_capture_output
fromagent.utils
and replaced the existing test-running logic with a call to this new function inrun_tests
. [1] [2]src/agent/utils.py
: Added therun_pytest_and_capture_output
function to capture pytest output usingredirect_stdout
andStringIO
.