Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions tests/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def test_codex_skill_contains_spawn_agent():
"""Codex skill file must reference spawn_agent."""
import graphify

skill = (Path(graphify.__file__).parent / "skill-codex.md").read_text()
skill = (Path(graphify.__file__).parent / "skill-codex.md").read_text(encoding="utf-8")
assert "spawn_agent" in skill


Expand All @@ -271,7 +271,10 @@ def test_codex_skill_uses_graphify_with_existing_graph():
fast-path block, which jumps straight to the query flow when a graph exists.
"""
import graphify
skill = (Path(graphify.__file__).parent / "skill-codex.md").read_text()
# encoding= matters: the skill is UTF-8 and the assertions below carry an em
# dash and an en dash. Without it Windows decodes through the locale codepage
# and the match fails on a file that is perfectly fine.
skill = (Path(graphify.__file__).parent / "skill-codex.md").read_text(encoding="utf-8")
assert "Fast path — existing graph" in skill
assert "skip Steps 1–5 entirely and jump straight to `## For /graphify query`" in skill
assert "graphify query" in skill
Expand Down Expand Up @@ -1161,7 +1164,10 @@ def test_hermes_skill_destination_posix_uses_home():
from graphify.__main__ import _platform_skill_destination
with patch("graphify.__main__.platform.system", return_value="Linux"):
dst = _platform_skill_destination("hermes", project=False)
assert str(dst).endswith(".hermes/skills/graphify/SKILL.md"), dst
# Compare the path, not the host's separator: patching platform.system() does
# not change pathlib's flavour, so on Windows dst is still a WindowsPath and
# str() renders backslashes. The POSIX branch IS being exercised here.
assert dst.as_posix().endswith(".hermes/skills/graphify/SKILL.md"), dst


def _cli_dispatched_commands() -> set[str]:
Expand Down
5 changes: 5 additions & 0 deletions tests/test_install_roundtrip.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ def test_skill_roundtrip_at_real_destination(platform, project, tmp_path, monkey
home.mkdir()
project_dir.mkdir()
monkeypatch.chdir(project_dir)
# hermes resolves its Windows destination through %LOCALAPPDATA%, not ~ (#1403),
# so patching Path.home alone leaves it pointing at conftest._sandbox_home and
# the startswith(home) check below compares against the wrong tree. Redirect it
# to this test's home, mirroring what conftest does session-wide.
monkeypatch.setenv("LOCALAPPDATA", str(home / "AppData" / "Local"))

with patch("graphify.__main__.Path.home", return_value=home):
dst = mainmod._platform_skill_destination(
Expand Down
Loading