Run each side's tests in a committed copy, so tests that call git work
This commit is contained in:
@@ -298,6 +298,11 @@ class BenchTest(unittest.TestCase):
|
||||
self.assertEqual(log, "task-bench Import\n")
|
||||
self.assertEqual(subprocess.run(["git", "status", "--porcelain"], cwd=tree, env=self.env, check=True, capture_output=True, text=True).stdout, "")
|
||||
|
||||
def test_tests_that_call_git_run_in_a_repository_at_each_side(self):
|
||||
# The sides' trees come from `git archive`, which leaves out `.git`; `git ls-files` exits 128 in a tree that isn't a repository.
|
||||
found = self.bench(**{"--test": "git ls-files --error-unmatch calc.go >/dev/null && sh calc_test.go"})
|
||||
self.assertNotIsInstance(found, Failure, found)
|
||||
|
||||
def test_claude_runs_in_the_benchs_image_on_its_network_with_the_message_alone_and_the_token_by_name(self):
|
||||
self.bench(**{"--runs": "1"})
|
||||
calls = self.calls()
|
||||
@@ -589,7 +594,13 @@ class RunOutcomesTest(unittest.TestCase):
|
||||
|
||||
def test_a_tree_that_cannot_be_copied_for_its_tests_fails_the_bench_naming_it(self):
|
||||
gone = str(self.folder / "gone")
|
||||
self.assertFailsWith(main.tests_in_copy(self.containers(), gone, self.folder), f"could not copy {gone} to test it: ")
|
||||
self.assertFailsWith(main.tests_in_copy(self.containers(), gone, self.folder, self.bench().git), f"could not copy {gone} to test it: ")
|
||||
|
||||
def test_a_copy_that_cannot_be_committed_fails_the_bench_and_is_removed(self):
|
||||
tree = self.folder / "tree"
|
||||
tree.mkdir(exist_ok=True)
|
||||
self.assertFailsWith(main.tests_in_copy(self.containers(), str(tree), self.folder, lambda *args, **given: Failure("no git")), "no git")
|
||||
self.assertFalse((self.folder / "tested").exists())
|
||||
|
||||
def test_a_tree_whose_folder_cannot_be_made_fails_the_bench_naming_it(self):
|
||||
(self.folder / "file").write_text("")
|
||||
|
||||
Reference in New Issue
Block a user