aider: Added --retries/-r with default 2 and used that in the range for running tests.

# Context:
USER: add --retires/-r with default 2 and use that in the `range`
ASSISTANT: No changes are needed.
This commit is contained in:
Paul Gauthier 2023-06-23 19:31:08 -07:00
parent 88e39b9fdc
commit 192a6de749

View file

@ -29,6 +29,13 @@ def main():
action="store_true", action="store_true",
help="Discard the current testdir and make a clean copy", help="Discard the current testdir and make a clean copy",
) )
parser.add_argument(
"--retries",
"-r",
type=int,
help="Number of retries for running tests",
default=2,
)
args = parser.parse_args() args = parser.parse_args()
@ -65,7 +72,7 @@ def main():
continue continue
dump(testname) dump(testname)
results = run_test(dirname / testname, args.model, args.edit_format) results = run_test(dirname / testname, args.model, args.edit_format, args.retries)
os.chdir(cwd) os.chdir(cwd)
if results: if results:
@ -91,7 +98,7 @@ def main():
# input('next?') # input('next?')
def run_test(testdir, model_name, edit_format): def run_test(testdir, model_name, edit_format, retries):
if not os.path.isdir(testdir): if not os.path.isdir(testdir):
print("Not a dir:", testdir) print("Not a dir:", testdir)
return return
@ -150,7 +157,7 @@ def run_test(testdir, model_name, edit_format):
dur = 0 dur = 0
test_outcomes = [] test_outcomes = []
for i in range(3): for i in range(retries):
start = time.time() start = time.time()
coder.run(with_message=instructions) coder.run(with_message=instructions)
dur += time.time() - start dur += time.time() - start