aider: Handled subprocess timeout exception and set all_tests_passed to false.

# Context:
USER: will that raise an exception?
ASSISTANT: Yes, the current code will raise a `subprocess.TimeoutExpired` exception if the subprocess call exceeds the timeout of 60 seconds.
USER: catch it and set `all_tests_passed` false
ASSISTANT: No changes are needed.
This commit is contained in:
Paul Gauthier 2023-06-23 16:13:10 -07:00
parent 7afbb2a9e3
commit 885a2341cb

View file

@ -146,9 +146,13 @@ def run_tests():
for test_file in test_files:
dump(test_file)
result = subprocess.run(["pytest", test_file], capture_output=True, text=True, timeout=60)
print(result.stdout)
print(result.stderr)
try:
result = subprocess.run(["pytest", test_file], capture_output=True, text=True, timeout=60)
print(result.stdout)
print(result.stderr)
except subprocess.TimeoutExpired:
all_tests_passed = False
print(f"Test {test_file} timed out")
if result.returncode != 0:
all_tests_passed = False