mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-10-12 12:32:11 -03:00
test: fold the last Windows path and label assumptions
Second pass over the informational Windows job (91 failures -> 11 -> 0):
* `_identity`/`_fold` now wrap the assertions my first sweep skipped: the
parenthesised and multi-line ones, and the ones whose token list was
incomplete (`base_models_roots`, `embeddings_roots`).
* The reconciler's `current_name` and `active_roots` carry the drive-prefixed
label on Windows ("C: loras"), so the last direct comparison goes through
`_root_label_names` too.
* `open_settings_location` reveals the settings *file* with
`explorer /select,` on Windows instead of opening the containing folder, so
that test asserts the platform's call instead of the POSIX one.
* Three more expectations are written in the business form the code returns
(metadata payload, extracted download paths, hydrated preview URL).
This commit is contained in:
@@ -361,13 +361,11 @@ def test_save_paths_removes_template_default_library(monkeypatch, tmp_path):
|
||||
}
|
||||
assert _identity(payload["folder_paths"]) == _identity(expected_folder_paths)
|
||||
assert _identity(payload["default_lora_root"]) == _identity(folder_paths["loras"][0].replace("\\", "/"))
|
||||
assert (
|
||||
payload["default_checkpoint_root"]
|
||||
== folder_paths["checkpoints"][0].replace("\\", "/")
|
||||
assert _identity(payload["default_checkpoint_root"]) == _identity(
|
||||
folder_paths["checkpoints"][0].replace("\\", "/")
|
||||
)
|
||||
assert (
|
||||
payload["default_embedding_root"]
|
||||
== folder_paths["embeddings"][0].replace("\\", "/")
|
||||
assert _identity(payload["default_embedding_root"]) == _identity(
|
||||
folder_paths["embeddings"][0].replace("\\", "/")
|
||||
)
|
||||
assert _identity(payload["metadata"]) == _identity({"display_name": "ComfyUI", "source": "comfyui"})
|
||||
assert payload["activate"] is True
|
||||
@@ -419,12 +417,12 @@ def test_save_paths_keeps_default_roots_in_extra_paths(monkeypatch: pytest.Monke
|
||||
|
||||
assert fake_settings.name == "comfyui"
|
||||
assert _identity(fake_settings.payload["extra_folder_paths"]["loras"]) == _identity([str(extra_lora_dir).replace("\\", "/")])
|
||||
assert fake_settings.payload["extra_folder_paths"]["checkpoints"] == [
|
||||
assert _identity(fake_settings.payload["extra_folder_paths"]["checkpoints"]) == _identity([
|
||||
str(extra_checkpoint_dir).replace("\\", "/")
|
||||
]
|
||||
assert fake_settings.payload["extra_folder_paths"]["embeddings"] == [
|
||||
])
|
||||
assert _identity(fake_settings.payload["extra_folder_paths"]["embeddings"]) == _identity([
|
||||
str(extra_embedding_dir).replace("\\", "/")
|
||||
]
|
||||
])
|
||||
assert _identity(fake_settings.payload["default_lora_root"]) == _identity(str(extra_lora_dir).replace("\\", "/"))
|
||||
assert _identity(fake_settings.payload["default_checkpoint_root"]) == _identity(str(extra_checkpoint_dir).replace("\\", "/"))
|
||||
assert _identity(fake_settings.payload["default_embedding_root"]) == _identity(str(extra_embedding_dir).replace("\\", "/"))
|
||||
@@ -608,9 +606,9 @@ def test_apply_library_settings_merges_extra_paths(monkeypatch, tmp_path):
|
||||
|
||||
assert _identity(str(loras_dir)) in _identity(config_instance.loras_roots)
|
||||
assert _identity(str(extra_loras_dir)) in _identity(config_instance.extra_loras_roots)
|
||||
assert str(checkpoints_dir) in config_instance.base_models_roots
|
||||
assert _identity(str(checkpoints_dir)) in _identity(config_instance.base_models_roots)
|
||||
assert _identity(str(extra_checkpoints_dir)) in _identity(config_instance.extra_checkpoints_roots)
|
||||
assert str(embeddings_dir) in (config_instance.embeddings_roots or [])
|
||||
assert _identity(str(embeddings_dir)) in _identity((config_instance.embeddings_roots or []))
|
||||
assert _identity(str(extra_embeddings_dir)) in _identity(config_instance.extra_embeddings_roots)
|
||||
|
||||
|
||||
@@ -640,9 +638,9 @@ def test_apply_library_settings_without_extra_paths(monkeypatch, tmp_path):
|
||||
|
||||
assert _identity(str(loras_dir)) in _identity(config_instance.loras_roots)
|
||||
assert _identity(config_instance.extra_loras_roots) == _identity([])
|
||||
assert str(checkpoints_dir) in config_instance.base_models_roots
|
||||
assert _identity(str(checkpoints_dir)) in _identity(config_instance.base_models_roots)
|
||||
assert _identity(config_instance.extra_checkpoints_roots) == _identity([])
|
||||
assert str(embeddings_dir) in (config_instance.embeddings_roots or [])
|
||||
assert _identity(str(embeddings_dir)) in _identity((config_instance.embeddings_roots or []))
|
||||
assert _identity(config_instance.extra_embeddings_roots) == _identity([])
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user