MCPcopy Create free account
hub / github.com/github/spec-kit / test_load_uses_utf8_encoding

Method test_load_uses_utf8_encoding

tests/test_presets.py:2907–2925  ·  view source on GitHub ↗
(self, project_dir, monkeypatch)

Source from the content-addressed store, hash-verified

2905 assert seen["encoding"] == "utf-8"
2906
2907 def test_load_uses_utf8_encoding(self, project_dir, monkeypatch):
2908 from specify_cli import load_init_options
2909
2910 opts_file = project_dir / ".specify" / "init-options.json"
2911 opts_file.parent.mkdir(parents=True, exist_ok=True)
2912 opts_file.write_text('{"ai": "codex"}', encoding="utf-8")
2913
2914 original_read_text = Path.read_text
2915 seen: dict[str, str | None] = {}
2916
2917 def spy_read_text(path, *args, **kwargs):
2918 if path == opts_file:
2919 seen["encoding"] = kwargs.get("encoding")
2920 return original_read_text(path, *args, **kwargs)
2921
2922 monkeypatch.setattr(Path, "read_text", spy_read_text)
2923
2924 assert load_init_options(project_dir) == {"ai": "codex"}
2925 assert seen["encoding"] == "utf-8"
2926
2927 def test_load_returns_empty_when_missing(self, project_dir):
2928 from specify_cli import load_init_options

Callers

nothing calls this directly

Calls 1

load_init_optionsFunction · 0.90

Tested by

no test coverage detected