tenseleyflow/sway / 17cda3f

Browse files

tests/pre_commit_hook: assert 3 hooks + PyPI pin + docker image path

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
17cda3f61ae42a17b6126f471e6dc9baf2c9677f
Parents
b76065a
Tree
ce6254e

1 changed file

StatusFile+-
M tests/integration/test_pre_commit_hook.py 25 4
tests/integration/test_pre_commit_hook.pymodified
@@ -47,19 +47,40 @@ HOOKS_PATH = REPO_ROOT / ".pre-commit-hooks.yaml"
4747
 
4848
 
4949
 def test_pre_commit_hooks_yaml_is_valid() -> None:
50
-    """Smoke: ``.pre-commit-hooks.yaml`` parses and declares the two
51
-    expected hooks. Cheap — runs without network — and catches
52
-    structural drift before the slow-lane invocation."""
50
+    """Smoke: ``.pre-commit-hooks.yaml`` parses and declares the three
51
+    expected hooks (system / isolated-venv / docker_image). Cheap —
52
+    runs without network — and catches structural drift before the
53
+    slow-lane invocation."""
5354
     assert HOOKS_PATH.exists(), f"missing {HOOKS_PATH}"
5455
     hooks = yaml.safe_load(HOOKS_PATH.read_text(encoding="utf-8"))
5556
     assert isinstance(hooks, list)
5657
     ids = [h["id"] for h in hooks]
57
-    assert ids == ["sway-gate", "sway-gate-isolated"], f"unexpected hook ids: {ids}"
58
+    assert ids == [
59
+        "sway-gate",
60
+        "sway-gate-isolated",
61
+        "sway-gate-docker",
62
+    ], f"unexpected hook ids: {ids}"
63
+
5864
     system_hook = next(h for h in hooks if h["id"] == "sway-gate")
5965
     assert system_hook["language"] == "system"
6066
     assert system_hook["pass_filenames"] is False
6167
     assert system_hook["entry"] == "sway gate"
6268
 
69
+    isolated_hook = next(h for h in hooks if h["id"] == "sway-gate-isolated")
70
+    assert isolated_hook["language"] == "python"
71
+    # Post-F05: the isolated variant pins the PyPI wheel, not a git SHA.
72
+    assert any(
73
+        dep.startswith("dlm-sway[hf]==") for dep in isolated_hook["additional_dependencies"]
74
+    ), f"isolated hook deps lost PyPI pin: {isolated_hook['additional_dependencies']!r}"
75
+
76
+    docker_hook = next(h for h in hooks if h["id"] == "sway-gate-docker")
77
+    assert docker_hook["language"] == "docker_image"
78
+    assert docker_hook["pass_filenames"] is False
79
+    # Entry is "<image> <cmd>" — first token is the image, rest is argv.
80
+    assert docker_hook["entry"].startswith("ghcr.io/tenseleyflow/sway-gate:"), (
81
+        f"docker hook image path changed: {docker_hook['entry']!r}"
82
+    )
83
+
6384
 
6485
 def _build_random_lora_adapter(base_dir: Path, out_dir: Path) -> None:
6586
     """Same deterministic LoRA build the other integration tests use.