mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
fix(settings): preserve template settings file
This commit is contained in:
@@ -26,6 +26,12 @@ def read_settings_file(path: Path) -> dict:
|
||||
return json.load(handle)
|
||||
|
||||
|
||||
def read_example_settings() -> dict:
|
||||
example_path = Path(__file__).resolve().parents[1] / "settings.json.example"
|
||||
with example_path.open('r', encoding='utf-8') as handle:
|
||||
return json.load(handle)
|
||||
|
||||
|
||||
def test_missing_settings_creates_defaults_and_emits_warnings(tmp_path):
|
||||
manager = get_settings_manager()
|
||||
settings_path = Path(manager.settings_file)
|
||||
@@ -52,6 +58,20 @@ def test_missing_settings_creates_defaults_and_emits_warnings(tmp_path):
|
||||
]
|
||||
|
||||
|
||||
def test_template_settings_are_preserved_on_restart(tmp_path):
|
||||
manager = get_settings_manager()
|
||||
settings_path = Path(manager.settings_file)
|
||||
|
||||
example_payload = read_example_settings()
|
||||
assert read_settings_file(settings_path) == example_payload
|
||||
|
||||
reset_settings_manager()
|
||||
|
||||
manager = get_settings_manager()
|
||||
assert Path(manager.settings_file) == settings_path
|
||||
assert read_settings_file(settings_path) == example_payload
|
||||
|
||||
|
||||
def test_invalid_settings_recovers_with_defaults(tmp_path):
|
||||
config_dir = Path(settings_paths.user_config_dir())
|
||||
config_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
Reference in New Issue
Block a user