Run loop-claude from the checkout root wherever inside it is started

This commit is contained in:
2026-09-25 08:39:37 +02:00
parent ebe6bebea6
commit 13f0aae899
4 changed files with 24 additions and 6 deletions
+11
View File
@@ -5,6 +5,7 @@ import json
import os
import pathlib
import stat
import subprocess
import tempfile
import unittest
import unittest.mock
@@ -84,6 +85,16 @@ class HumanTurns(unittest.TestCase):
]), 2)
class CheckoutRoot(unittest.TestCase):
def test_is_the_checkout_from_any_directory_inside_it_and_the_directory_itself_outside_one(self):
with tempfile.TemporaryDirectory() as root, contextlib.chdir(root):
self.assertEqual(loop.checkout_root(), os.getcwd())
subprocess.run(["git", "init", "-q"], check=True)
os.makedirs("a/b")
with contextlib.chdir("a/b"):
self.assertEqual(loop.checkout_root(), root)
class Project(unittest.TestCase):
def test_names_a_checkout_relative_to_code_and_any_other_relative_to_root(self):
with unittest.mock.patch.dict(os.environ, {"HOME": "/h"}):