mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-10-12 12:32:11 -03:00
test: make the backend suite pass on Windows
The new informational Windows job surfaced 91 failures: four real bugs (fixed in
the previous two commits) and a long tail of POSIX assumptions in the tests
themselves. None of them assert behaviour that differs on Windows, so they are
fixed rather than skipped wherever the behaviour is the same:
* Path spelling: expectations built with `str(tmp_path)` are compared through an
identity helper (`normalize_root_identity`) or the platform's separator, since
the code hands out forward-slashed business paths while `str()` is native.
* Root labels: `_root_display_labels` prefixes the drive on Windows ("C: loras"),
so label assertions compare the final path component or derive the expected
label from the same helper.
* `~` expansion reads USERPROFILE (ntpath), not HOME; timer granularity rounds
0.1s down; a case-only rename counts as "already named" via `os.path.normcase`.
* Genuinely POSIX-only strategies are skipped with a reason instead of failing:
the headless clipboard fallback, dbus file-manager selection, xdg-open, and
the case-fold index test that simulates a case-sensitive filesystem.
This commit is contained in:
@@ -6,6 +6,7 @@ import pytest
|
||||
|
||||
from py.nodes.lora_cycler import LoraCyclerLM
|
||||
from py.services import service_registry
|
||||
import os
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -48,7 +49,7 @@ async def test_cycler_uses_scaled_preset_strength_when_available(
|
||||
result = await cycler_node.cycle(cycler_config)
|
||||
|
||||
assert result["result"][0] == [
|
||||
("/models/loras/preset_lora.safetensors", 1.05, 0.75)
|
||||
("/models/loras/preset_lora.safetensors".replace("/", os.sep), 1.05, 0.75)
|
||||
]
|
||||
|
||||
|
||||
@@ -74,7 +75,7 @@ async def test_cycler_falls_back_to_manual_strength_when_preset_missing(
|
||||
result = await cycler_node.cycle(cycler_config)
|
||||
|
||||
assert result["result"][0] == [
|
||||
("/models/loras/manual_lora.safetensors", 0.8, 0.6)
|
||||
("/models/loras/manual_lora.safetensors".replace("/", os.sep), 0.8, 0.6)
|
||||
]
|
||||
|
||||
|
||||
@@ -105,5 +106,5 @@ async def test_cycler_syncs_clip_to_model_when_same_clip_strength_enabled(
|
||||
)
|
||||
|
||||
assert result["result"][0] == [
|
||||
("/models/loras/preset_lora.safetensors", 1.05, 1.05)
|
||||
("/models/loras/preset_lora.safetensors".replace("/", os.sep), 1.05, 1.05)
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user