added --no-test

This commit is contained in:
Paul Gauthier 2023-06-24 06:57:14 -07:00
parent 6731fb0710
commit 29943b8c21

View file

@ -4,8 +4,8 @@ import json
import os import os
import shutil import shutil
import subprocess import subprocess
import time
import threading import threading
import time
from json.decoder import JSONDecodeError from json.decoder import JSONDecodeError
from pathlib import Path from pathlib import Path
@ -30,6 +30,11 @@ 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(
"--no-test",
action="store_true",
help="Do not run tests",
)
parser.add_argument( parser.add_argument(
"--retries", "--retries",
"-r", "-r",
@ -74,7 +79,9 @@ def main():
continue continue
dump(testname) dump(testname)
results = run_test(dirname / testname, args.model, args.edit_format, args.retries) results = run_test(
dirname / testname, args.model, args.edit_format, args.retries, args.no_test
)
os.chdir(cwd) os.chdir(cwd)
if results: if results:
@ -113,7 +120,7 @@ def main():
print(dirname / testname) print(dirname / testname)
def run_test(testdir, model_name, edit_format, retries): def run_test(testdir, model_name, edit_format, retries, no_test):
if not os.path.isdir(testdir): if not os.path.isdir(testdir):
print("Not a dir:", testdir) print("Not a dir:", testdir)
return return
@ -173,6 +180,7 @@ def run_test(testdir, model_name, edit_format, retries):
dur = 0 dur = 0
test_outcomes = [] test_outcomes = []
for i in range(retries): for i in range(retries):
def run_coder(stop_event): def run_coder(stop_event):
try: try:
coder.run(with_message=instructions) coder.run(with_message=instructions)
@ -201,6 +209,9 @@ def run_test(testdir, model_name, edit_format, retries):
if coder.num_control_c: if coder.num_control_c:
raise KeyboardInterrupt raise KeyboardInterrupt
if no_test:
return
errors = run_tests(history_fname) errors = run_tests(history_fname)
if errors: if errors: