Stevesolun commited on
Commit
94e1c67
·
verified ·
1 Parent(s): ddd8ba3

Sync ctx 59d617a (part 3)

Browse files

GitHub commit: 59d617a5251ad4aa8624e883d6fe21102e66cce6

Files changed (1) hide show
  1. src/tests/test_ctx_init.py +28 -0
src/tests/test_ctx_init.py CHANGED
@@ -1007,6 +1007,34 @@ def test_runtime_graph_install_without_full_entities_is_not_full_install(
1007
  assert ci._graph_full_install_complete(wiki) is False
1008
 
1009
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1010
  def test_graph_install_force_prunes_stale_generated_files(
1011
  tmp_path: Path,
1012
  monkeypatch,
 
1007
  assert ci._graph_full_install_complete(wiki) is False
1008
 
1009
 
1010
+ def test_full_graph_install_uses_system_tar_after_validation(
1011
+ tmp_path: Path,
1012
+ monkeypatch,
1013
+ ) -> None:
1014
+ archive = _write_graph_archive(tmp_path)
1015
+ wiki = tmp_path / "installed-wiki"
1016
+ calls: list[list[str]] = []
1017
+
1018
+ def fake_run(cmd: list[str], **_kwargs: object) -> SimpleNamespace:
1019
+ calls.append(list(cmd))
1020
+ target = Path(cmd[cmd.index("-C") + 1])
1021
+ with tarfile.open(archive, "r:gz") as tf:
1022
+ tf.extractall(target)
1023
+ return SimpleNamespace(returncode=0, stdout="", stderr="")
1024
+
1025
+ monkeypatch.setattr(ci.shutil, "which", lambda _name: "tar")
1026
+ monkeypatch.setattr(ci.subprocess, "run", fake_run)
1027
+
1028
+ ci._extract_graph_archive(archive, wiki, install_mode="full")
1029
+
1030
+ assert len(calls) == 1
1031
+ assert calls[0][:3] == ["tar", "-xzf", str(archive)]
1032
+ assert calls[0][3] == "-C"
1033
+ assert Path(calls[0][4]).name.startswith(".installed-wiki-stage-")
1034
+ assert ci._graph_full_install_complete(wiki) is True
1035
+ assert (wiki / "entities" / "skills" / "current.md").is_file()
1036
+
1037
+
1038
  def test_graph_install_force_prunes_stale_generated_files(
1039
  tmp_path: Path,
1040
  monkeypatch,