Bench features in task-bench with --tasks features, from the folder the config names as bench-tasks
CI / tests (pull_request) Has been cancelled
CI / tests (pull_request) Has been cancelled
This commit is contained in:
@@ -402,15 +402,15 @@ class ReportTest(unittest.TestCase):
|
||||
]
|
||||
|
||||
def test_names_the_commits_the_bugs_the_runs_and_what_ran_them_above_the_table(self):
|
||||
told = main.report(self.SIDES, self.NAMES, main.Asked(seed=1, bugs=1, runs=2), self.RESULTS)
|
||||
told = main.report(self.SIDES, self.NAMES, main.Asked(main.BUG, 2, 1, 1), self.RESULTS, [])
|
||||
self.assertEqual(told, ["task-bench: base bbbbbbbbbbbb, head hhhhhhhhhhhh. 1 bug, each run 2 times at each side by claude-haiku-5-5 in Claude Code 2.1.330.", "", *self.TABLE, ""])
|
||||
|
||||
def test_says_where_fewer_bugs_were_planted_than_asked_for_and_where_no_run_finished(self):
|
||||
told = main.report(self.SIDES, self.NAMES, main.Asked(seed=1, bugs=3, runs=1), self.RESULTS[1:])
|
||||
told = main.report(self.SIDES, self.NAMES, main.Asked(main.BUG, 1, 1, 3), self.RESULTS[1:], ["Planted 1 of the 3 bugs asked for: no other mutant the tests kill becomes one."])
|
||||
self.assertEqual(told[:3], ["task-bench: base bbbbbbbbbbbb, head hhhhhhhhhhhh. 1 bug, each run 1 time at each side by no run that finished.", "Planted 1 of the 3 bugs asked for: no other mutant the tests kill becomes one.", ""])
|
||||
|
||||
def test_a_stopped_bench_tells_why_then_how_far_it_came_then_the_table(self):
|
||||
told = main.stopped_report(Failure("claude could not use the API: Invalid bearer token"), self.RESULTS, 10, self.NAMES, pathlib.Path("/reviews/task-bench"))
|
||||
told = main.stopped_report(Failure("claude could not use the API: Invalid bearer token"), self.RESULTS, 10, self.NAMES, pathlib.Path("/reviews/task-bench"), main.BUG)
|
||||
self.assertEqual(told, Failure("\n".join(["claude could not use the API: Invalid bearer token", "task-bench stopped after 2 of 10 runs, which results.json holds in /reviews/task-bench:", "", *self.TABLE])))
|
||||
|
||||
|
||||
@@ -447,13 +447,13 @@ class MainTest(unittest.TestCase):
|
||||
|
||||
|
||||
def test_a_run_that_did_not_finish_has_no_tokens_in_the_digest(self):
|
||||
task = main.Task(1, Mutant("calc.go", 4, 11, "ARITHMETIC_BASE"), {}, {"base": "boom", "head": "bang"})
|
||||
task = main.Task(1, "calc.go:4:11 ARITHMETIC_BASE", {}, {"base": "boom", "head": "bang"}, file="calc.go")
|
||||
entries = (Entry(),)
|
||||
bug = main.digested(task, [Result(1, "base", 2, False, None, entries), Result(2, "base", 1, True, None)], pathlib.Path("/bench"))
|
||||
bug = main.digested(task, [Result(1, "base", 2, False, None, entries), Result(2, "base", 1, True, None)], pathlib.Path("/bench"), "bug")
|
||||
self.assertEqual(bug, ("1: calc.go:4:11 ARITHMETIC_BASE", "calc.go", "boom", [("bug-1-base-2", False, None, entries)]))
|
||||
|
||||
def test_records_a_run_that_did_not_finish_without_figures(self):
|
||||
self.assertEqual(main.recorded(Result(1, "base", 2, False, None)), {"bug": 1, "side": "base", "run": 2, "passed": False, "finished": False})
|
||||
self.assertEqual(main.recorded(Result(1, "base", 2, False, None), "bug"), {"bug": 1, "side": "base", "run": 2, "passed": False, "finished": False})
|
||||
|
||||
|
||||
class Recorded:
|
||||
@@ -494,25 +494,25 @@ class RunOutcomesTest(unittest.TestCase):
|
||||
self.tree.mkdir()
|
||||
(self.tree / "calc.go").write_text(BASE_CODE)
|
||||
self.trees = {"base": str(self.tree), "head": str(self.tree)}
|
||||
self.task = main.Task(1, self.MUTANT, self.trees, {"base": "got 3", "head": "got 3"})
|
||||
self.task = main.Task(1, "calc.go:4:11 ARITHMETIC_BASE", self.trees, {"base": "got 3", "head": "got 3"}, file="calc.go")
|
||||
|
||||
def containers(self, *runs: Ran | Failure) -> Containers:
|
||||
return Containers(InTurn(*runs), "bench", "go test ./...", 512, "1000:1000")
|
||||
|
||||
def bench(self, *runs: Ran | Failure) -> main.Bench:
|
||||
return main.Bench("", {"base": "b", "head": "h"}, self.trees, main.Asked(seed=1, bugs=1, runs=1), self.containers(*runs), self.folder, lambda *args, **given: "", lambda line: None)
|
||||
return main.Bench("", {"base": "b", "head": "h"}, self.trees, main.Asked(main.BUG, 1, 1, 1), self.containers(*runs), self.folder, lambda *args, **given: "", lambda line: None)
|
||||
|
||||
def test_a_fix_whose_tests_run_out_of_time_does_not_pass(self):
|
||||
late = TimedOut("docker run still ran after 30 min")
|
||||
self.assertEqual(main.fixed(self.task, "base", 1, self.containers(Ran(0, ""), late), self.folder), Result(1, "base", 1, False, None))
|
||||
self.assertEqual(main.fixed(self.task, "base", 1, self.containers(Ran(0, ""), late), self.folder, main.BUG), Result(1, "base", 1, False, None))
|
||||
|
||||
def test_a_fix_whose_tests_docker_could_not_run_fails_the_bench(self):
|
||||
broke = Failure("docker could not start: No such file or directory")
|
||||
self.assertEqual(main.fixed(self.task, "base", 1, self.containers(Ran(0, ""), broke), self.folder), broke)
|
||||
self.assertEqual(main.fixed(self.task, "base", 1, self.containers(Ran(0, ""), broke), self.folder, main.BUG), broke)
|
||||
|
||||
def test_tests_docker_could_not_run_without_a_bug_fail_the_bench(self):
|
||||
broke = Failure("docker could not start: No such file or directory")
|
||||
self.assertEqual(main.benched(self.bench(broke), []), broke)
|
||||
self.assertEqual(main.benched(self.bench(broke), lambda bench: main.planted_tasks(bench, [])), broke)
|
||||
|
||||
def test_a_mutant_whose_tests_run_out_of_time_is_passed_over(self):
|
||||
late = TimedOut("docker run still ran after 30 min")
|
||||
@@ -528,11 +528,11 @@ class RunOutcomesTest(unittest.TestCase):
|
||||
|
||||
def test_a_tree_that_cannot_be_copied_for_a_fix_fails_the_bench_naming_the_bug_and_side(self):
|
||||
task = dataclasses.replace(self.task, trees={"base": str(self.folder / "gone"), "head": str(self.tree)})
|
||||
self.assertFailsWith(main.fixed(task, "base", 1, self.containers(), self.folder), "could not copy bug 1's tree at the base: ")
|
||||
self.assertFailsWith(main.fixed(task, "base", 1, self.containers(), self.folder, main.BUG), "could not copy bug 1's tree at the base: ")
|
||||
|
||||
def test_failing_to_make_the_tree_that_checks_a_fix_fails_the_bench_naming_the_bug_and_side(self):
|
||||
(self.folder / "check").mkdir()
|
||||
self.assertFailsWith(main.fixed(self.task, "base", 1, self.containers(Ran(0, "")), self.folder), "could not make the tree that checks bug 1's fix at the base: ")
|
||||
self.assertFailsWith(main.fixed(self.task, "base", 1, self.containers(Ran(0, "")), self.folder, main.BUG), "could not make the tree that checks bug 1's fix at the base: ")
|
||||
|
||||
def test_results_that_cannot_be_written_fail_the_bench_naming_the_folder(self):
|
||||
bench = dataclasses.replace(self.bench(), folder=self.folder / "gone")
|
||||
|
||||
Reference in New Issue
Block a user