Run every claude the loop starts in a Claude home generated outside the clone
CI / tests (pull_request) Successful in 4m45s
CI / tests (pull_request) Successful in 4m45s
This commit is contained in:
@@ -4,7 +4,7 @@ import unittest
|
||||
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
|
||||
from loop_state.paths import config_folder, paths_from, RELEASE_ROOT, state_folder, with_release_tools, without_xdg_folders
|
||||
from loop_state.paths import claude_home, config_folder, in_claude_home, paths_from, RELEASE_ROOT, state_folder, with_release_tools, without_xdg_folders
|
||||
|
||||
TOOLS = str(RELEASE_ROOT / "bin")
|
||||
|
||||
@@ -45,7 +45,22 @@ class SetupFolders(unittest.TestCase):
|
||||
self.assertEqual((found.config_folder, found.models_file, found.state_folder), (pathlib.Path("/x/config/build-release"), pathlib.Path("/x/config/build-release/models.json"), pathlib.Path("/x/state/build-release")))
|
||||
|
||||
def test_an_environment_without_the_xdg_folders_keeps_every_other_variable(self):
|
||||
self.assertEqual(without_xdg_folders({"HOME": "/h", "XDG_CONFIG_HOME": "/c", "XDG_STATE_HOME": "/s", "XDG_DATA_HOME": "/d"}), {"HOME": "/h", "XDG_DATA_HOME": "/d"})
|
||||
self.assertEqual(without_xdg_folders({"HOME": "/h", "XDG_CONFIG_HOME": "/c", "XDG_STATE_HOME": "/s", "XDG_DATA_HOME": "/d", "XDG_CACHE_HOME": "/k"}), {"HOME": "/h", "XDG_CACHE_HOME": "/k"})
|
||||
|
||||
|
||||
class ClaudeHome(unittest.TestCase):
|
||||
def test_the_loops_claude_home_lies_in_the_setups_folder_of_the_data_home(self):
|
||||
self.assertEqual(claude_home({}, HOME), HOME / ".local" / "share" / "build-release" / "claude-home")
|
||||
self.assertEqual(claude_home({"XDG_DATA_HOME": "/x/data"}, HOME), pathlib.Path("/x/data/build-release/claude-home"))
|
||||
self.assertEqual(claude_home({"XDG_DATA_HOME": "data"}, HOME), HOME / ".local" / "share" / "build-release" / "claude-home")
|
||||
|
||||
def test_claude_codes_own_files_are_in_the_loops_claude_home_and_none_in_the_persons(self):
|
||||
found = paths_from(HOME, {"XDG_DATA_HOME": "/x/data"})
|
||||
home = pathlib.Path("/x/data/build-release/claude-home")
|
||||
self.assertEqual((found.claude_dir, found.claude_code_transcripts, found.model_catalog), (home, home / "projects", home / "cache" / "model-catalog"))
|
||||
|
||||
def test_a_claude_started_in_the_loops_home_is_told_so_and_keeps_every_other_variable(self):
|
||||
self.assertEqual(in_claude_home({"PATH": "/bin", "CLAUDE_CONFIG_DIR": "/elsewhere"}, HOME), {"PATH": "/bin", "CLAUDE_CONFIG_DIR": "/home/me/.local/share/build-release/claude-home"})
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user