From 885a2341cb26c391b7781b365635e1ab7986c40d Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Fri, 23 Jun 2023 16:13:10 -0700 Subject: [PATCH] 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. --- scripts/benchmark.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/benchmark.py b/scripts/benchmark.py index 2604f8874..ddc6227ce 100644 --- a/scripts/benchmark.py +++ b/scripts/benchmark.py @@ -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