Skip to content

The agent that grows with you

test(update): the transition fake tree carries the completion tail's imports

Brooklyn Nicholson5af9a8059731
diff --git a/tests/hermes_cli/test_update_completion_process.py b/tests/hermes_cli/test_update_completion_process.py
index dd2be1780bc..4ae48c91471 100644
--- a/tests/hermes_cli/test_update_completion_process.py
+++ b/tests/hermes_cli/test_update_completion_process.py
@@ -72,7 +72,14 @@ def transition(tmp_path):
" from hermes_cli.probe import event\n"
" event('activate')\n"
)
- (root / "hermes_constants.py").write_text("")
+ (root / "hermes_constants.py").write_text(
+ # source_completion's update lock resolves the process home through
+ # hermes_constants (never a profile override), like the Rust updater does.
+ "import os\n"
+ "from pathlib import Path\n"
+ "def get_process_hermes_home():\n"
+ " return Path(os.environ['HERMES_HOME'])\n"
+ )
(package / "venv_sync.py").write_text(
"from hermes_cli.probe import event\n"
"publish_launchers = lambda root: event('launchers')\n"
@@ -95,9 +102,16 @@ def transition(tmp_path):
"from hermes_cli.probe import event\n"
"write_source_stamp = lambda root: event('stamp')\n"
)
- # The shared completion tail is part of the NEW tree the child runs from.
+ # The shared completion tail is part of the NEW tree the child runs from, and so are the
+ # modules its imports reach: update_lock (the tail claims the shared update lock) and
+ # _subprocess_compat (it exposes PM's git for the builds) — neither exists in the OLD
+ # tree, and a bare copy of source_completion.py would die on ModuleNotFoundError.
shutil.copy2(Path(update_completion.__file__).with_name("source_completion.py"),
package / "source_completion.py")
+ shutil.copy2(Path(update_completion.__file__).with_name("update_lock.py"),
+ package / "update_lock.py")
+ shutil.copy2(Path(update_completion.__file__).with_name("_subprocess_compat.py"),
+ package / "_subprocess_compat.py")
(package / "main.py").write_text("")
(package / "update_cmd_config.py").write_text("_LAST_SIBLING_SNAPSHOTS = {}\n")
(package / "update_inventory.py").write_text(