feat: platform-dependent config path (APPDATA on Windows)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Vitali Graf
2026-04-08 10:26:17 +02:00
parent 4997bc6378
commit 5c8eecbb8b
2 changed files with 28 additions and 1 deletions
+19
View File
@@ -1,4 +1,6 @@
from pathlib import Path
from unittest.mock import patch
import os
import tomllib
from whisper_local.config import Config, load_config
@@ -57,3 +59,20 @@ class TestLoadConfig:
config_file.write_text("")
config = load_config(config_file)
assert config.hotkey == "KEY_F12"
class TestConfigPath:
@patch.dict(os.environ, {"APPDATA": "C:\\Users\\test\\AppData\\Roaming"})
@patch("whisper_local.config.sys")
def test_windows_config_path(self, mock_sys):
mock_sys.platform = "win32"
from whisper_local.config import _default_config_path
result = _default_config_path()
assert result == Path("C:\\Users\\test\\AppData\\Roaming") / "whisper-local" / "config.toml"
@patch("whisper_local.config.sys")
def test_linux_config_path(self, mock_sys):
mock_sys.platform = "linux"
from whisper_local.config import _default_config_path
result = _default_config_path()
assert result == Path.home() / ".config" / "whisper-local" / "config.toml"