mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
Revert "aider: Refactor run_unit_tests
to kill the subprocess when it times out."
This reverts commit 6632367978
.
This commit is contained in:
parent
426baa85dc
commit
3c63552628
1 changed files with 16 additions and 11 deletions
|
@ -374,18 +374,23 @@ def run_unit_tests(testdir, history_fname):
|
||||||
]
|
]
|
||||||
print(" ".join(command))
|
print(" ".join(command))
|
||||||
|
|
||||||
with subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) as proc:
|
try:
|
||||||
try:
|
result = subprocess.run(
|
||||||
stdout, _ = proc.communicate(timeout=timeout)
|
command,
|
||||||
if proc.returncode != 0:
|
stdout=subprocess.PIPE,
|
||||||
all_tests_passed = False
|
stderr=subprocess.STDOUT,
|
||||||
print(f"Test {test_file} failed")
|
text=True,
|
||||||
res = cleanup_test_output(stdout)
|
timeout=timeout,
|
||||||
except subprocess.TimeoutExpired:
|
)
|
||||||
proc.kill()
|
if result.returncode != 0:
|
||||||
proc.wait()
|
|
||||||
all_tests_passed = False
|
all_tests_passed = False
|
||||||
res = f"Test {test_file} timed out after {timeout} seconds."
|
print(f"Test {test_file} failed")
|
||||||
|
|
||||||
|
res = cleanup_test_output(result.stdout)
|
||||||
|
|
||||||
|
except subprocess.TimeoutExpired:
|
||||||
|
all_tests_passed = False
|
||||||
|
res = f"Test {test_file} timed out after {timeout} seconds."
|
||||||
|
|
||||||
with history_fname.open("a") as fh:
|
with history_fname.open("a") as fh:
|
||||||
fh.write(f"```\n{res}\n```")
|
fh.write(f"```\n{res}\n```")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue