aider/scripts
Paul Gauthier ded315a09a aider: Implemented run_tests function to execute test files and report their results.
# 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.
2023-06-23 14:56:07 -07:00
..
benchmark.py aider: Implemented run_tests function to execute test files and report their results. 2023-06-23 14:56:07 -07:00
versionbump.py refac 2023-06-20 16:59:55 -07:00