mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
improved logic for creating benchmark dirs
This commit is contained in:
parent
29d60b9ddb
commit
70050ca004
1 changed files with 15 additions and 11 deletions
|
@ -42,8 +42,9 @@ def main(
|
||||||
None, "--keyword", "-k", help="Only run tests that contain keyword"
|
None, "--keyword", "-k", help="Only run tests that contain keyword"
|
||||||
),
|
),
|
||||||
clean: bool = typer.Option(
|
clean: bool = typer.Option(
|
||||||
False, "--clean", "-c", help="Discard the current testdir and make a clean copy"
|
False, "--clean", "-c", help="Discard the existing testdir and make a clean copy"
|
||||||
),
|
),
|
||||||
|
make_new: bool = typer.Option(False, "--new", "-n", help="Make a new dated testdir"),
|
||||||
no_unit_tests: bool = typer.Option(False, "--no-unit-tests", help="Do not run unit tests"),
|
no_unit_tests: bool = typer.Option(False, "--no-unit-tests", help="Do not run unit tests"),
|
||||||
verbose: bool = typer.Option(False, "--verbose", "-v", help="Verbose output"),
|
verbose: bool = typer.Option(False, "--verbose", "-v", help="Verbose output"),
|
||||||
stats_only: bool = typer.Option(
|
stats_only: bool = typer.Option(
|
||||||
|
@ -61,18 +62,21 @@ def main(
|
||||||
dirname = Path(dirname)
|
dirname = Path(dirname)
|
||||||
|
|
||||||
if len(dirname.parts) == 1:
|
if len(dirname.parts) == 1:
|
||||||
dirname = BENCHMARK_DNAME / dirname
|
priors = list(BENCHMARK_DNAME.glob(f"*--{dirname}"))
|
||||||
|
if len(priors):
|
||||||
|
if not make_new:
|
||||||
|
print(f"Prior runs of {dirname} exist, use --new or name one explicitly")
|
||||||
|
print()
|
||||||
|
for prior in priors:
|
||||||
|
print(prior)
|
||||||
|
return
|
||||||
|
|
||||||
if clean and not dirname.exists():
|
|
||||||
print(f"--clean requires that {dirname} exists")
|
|
||||||
return
|
|
||||||
|
|
||||||
now = datetime.datetime.now()
|
|
||||||
now = now.strftime("%Y-%m-%d-%H-%M--")
|
|
||||||
|
|
||||||
if not dirname.exists():
|
|
||||||
if not re.match(r"\d\d\d\d-\d\d-\d\d-", str(dirname)):
|
if not re.match(r"\d\d\d\d-\d\d-\d\d-", str(dirname)):
|
||||||
dirname = dirname.parent / (now + dirname.name)
|
now = datetime.datetime.now()
|
||||||
|
now = now.strftime("%Y-%m-%d-%H-%M-%S--")
|
||||||
|
dirname = now + dirname.name
|
||||||
|
|
||||||
|
dirname = BENCHMARK_DNAME / dirname
|
||||||
|
|
||||||
dump(dirname)
|
dump(dirname)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue