One binary ships per platform: the cached file is the executed file.
| 22 | |
| 23 | |
| 24 | class BinarySelectionTests(unittest.TestCase): |
| 25 | """One binary ships per platform: the cached file is the executed file.""" |
| 26 | |
| 27 | def test_windows_executes_the_cached_binary(self): |
| 28 | binary = Path("cache") / "0.8.1" / _cli._WINDOWS_BINARY_NAME |
| 29 | |
| 30 | self.assertEqual(_cli._execution_path(binary, "win32"), binary) |
| 31 | |
| 32 | def test_non_windows_executes_the_cached_binary(self): |
| 33 | binary = Path("cache") / "0.8.1" / "codebase-memory-mcp" |
| 34 | |
| 35 | self.assertEqual(_cli._execution_path(binary, "linux"), binary) |
| 36 | |
| 37 | def test_cache_sensitive_mutation_classification_is_explicit(self): |
| 38 | self.assertEqual(_cli._runtime_mutation_action(["update"]), "update") |
| 39 | self.assertEqual( |
| 40 | _cli._runtime_mutation_action(["uninstall", "--yes"]), |
| 41 | "uninstall", |
| 42 | ) |
| 43 | self.assertEqual( |
| 44 | _cli._runtime_mutation_action(["install", "--yes"]), "install" |
| 45 | ) |
| 46 | self.assertIsNone(_cli._runtime_mutation_action(["cli", "update"])) |
| 47 | self.assertIsNone(_cli._runtime_mutation_action(["daemon", "update"])) |
| 48 | |
| 49 | def test_wrapper_uninstall_never_defaults_to_its_cache_binary(self): |
| 50 | linux_home = Path("fixtures") / "linux-home" |
| 51 | windows_local_app_data = Path("fixtures") / "windows-local-app-data" |
| 52 | defaults = ( |
| 53 | ( |
| 54 | "linux", |
| 55 | linux_home / ".local" / "bin", |
| 56 | mock.patch.object(Path, "home", return_value=linux_home), |
| 57 | ), |
| 58 | ( |
| 59 | "win32", |
| 60 | windows_local_app_data |
| 61 | / "Programs" |
| 62 | / "codebase-memory-mcp", |
| 63 | mock.patch.dict( |
| 64 | os.environ, |
| 65 | {"LOCALAPPDATA": str(windows_local_app_data)}, |
| 66 | ), |
| 67 | ), |
| 68 | ) |
| 69 | for platform_name, expected, path_fixture in defaults: |
| 70 | with self.subTest(platform=platform_name), mock.patch.object( |
| 71 | _cli.sys, "platform", platform_name |
| 72 | ), path_fixture: |
| 73 | self.assertEqual( |
| 74 | _cli._native_args(["uninstall", "--yes"]), |
| 75 | ["uninstall", "--yes", "--dir", str(expected)], |
| 76 | ) |
| 77 | |
| 78 | explicit_dir = Path("fixtures") / "explicit-install" |
| 79 | for platform_name in ("linux", "win32"): |
| 80 | with self.subTest( |
| 81 | platform=platform_name, explicit_dir=True |
nothing calls this directly
no outgoing calls
no test coverage detected