(self, project_dir, monkeypatch)
| 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 |
nothing calls this directly
no test coverage detected