mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-24 14:42:11 -03:00
fix(settings): use timezone-aware datetime for current timestamp
fix(tests): normalize stored paths in library upsert test
This commit is contained in:
@@ -2,7 +2,7 @@ import copy
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime
|
from datetime import datetime, timezone
|
||||||
from typing import Any, Dict, Iterable, List, Mapping, Optional
|
from typing import Any, Dict, Iterable, List, Mapping, Optional
|
||||||
|
|
||||||
from ..utils.settings_paths import ensure_settings_file
|
from ..utils.settings_paths import ensure_settings_file
|
||||||
@@ -143,7 +143,7 @@ class SettingsManager:
|
|||||||
self._save_settings()
|
self._save_settings()
|
||||||
|
|
||||||
def _current_timestamp(self) -> str:
|
def _current_timestamp(self) -> str:
|
||||||
return datetime.utcnow().replace(microsecond=0).isoformat() + "Z"
|
return datetime.now(timezone.utc).replace(microsecond=0).isoformat()
|
||||||
|
|
||||||
def _build_library_payload(
|
def _build_library_payload(
|
||||||
self,
|
self,
|
||||||
|
|||||||
@@ -111,7 +111,8 @@ def test_upsert_library_creates_entry_and_activates(manager, tmp_path):
|
|||||||
assert manager.get_active_library_name() == "studio"
|
assert manager.get_active_library_name() == "studio"
|
||||||
libraries = manager.get_libraries()
|
libraries = manager.get_libraries()
|
||||||
stored_paths = libraries["studio"]["folder_paths"]["loras"]
|
stored_paths = libraries["studio"]["folder_paths"]["loras"]
|
||||||
assert str(lora_dir).replace(os.sep, "/") in stored_paths
|
normalized_stored_paths = [p.replace(os.sep, "/") for p in stored_paths]
|
||||||
|
assert str(lora_dir).replace(os.sep, "/") in normalized_stored_paths
|
||||||
|
|
||||||
|
|
||||||
def test_delete_library_switches_active(manager, tmp_path):
|
def test_delete_library_switches_active(manager, tmp_path):
|
||||||
|
|||||||
Reference in New Issue
Block a user