mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 10:14:59 +00:00
![]() # Context: USER: implement `run_tests` ASSISTANT: To implement the `run_tests` function, we will use the `subprocess` module to run the test files in the current working directory. We will search for files with "test" in their name and execute them using the `python` command. The function will return `True` if all tests pass and `False` otherwise. Here's the updated `run_tests` function: ```python scripts/benchmark.py <<<<<<< ORIGINAL def run_tests(): # find files in the cwd with test in their name and run them # return true if they all pass pass ======= import subprocess def run_tests(): test_files = [file for file in os.listdir() if "test" in file and file.endswith(".py")] all_tests_passed = True for test_file in test_files: result = subprocess.run(["python", test_file], capture_output=True, text=True) if result.returncode != 0: all_tests_passed = False print(f"Test {test_file} failed with the following output:\n{result.stderr}") return all_tests_passed >>>>>>> UPDATED ``` This change will allow the `run_tests` function to execute test files and report their results. |
||
---|---|---|
.. | ||
benchmark.py | ||
versionbump.py |