test(download): compare rule-routed save dirs as paths, not strings

The feat/download-root-rules merge added two tests asserting the joined
save_dir against a str(Path) expectation. `_calculate_relative_path` returns a
forward-slashed relative path that `os.path.join` appends to a native-spelled
root, so on Windows the value is "...\unet-archive\Flux.1 D/fantasy" while the
expectation is "...\unet-archive\Flux.1 D\fantasy" -- purely a separator
difference. Only those two assertions failed (3844 passed), and the Windows job
was green at the merge's first parent (b197793b).

Capture save_dir as a Path, like every other fake in this file, and compare
Path objects so the assertions pin the routed root -- their actual subject --
instead of the host separator.
This commit is contained in:
Will Miao
2026-10-13 11:35:39 +08:00
parent e27500c80f
commit d4a01c8d6d
@@ -2368,7 +2368,11 @@ def _capture_execute_download(monkeypatch, captured):
async def fake_execute_download(self, **kwargs):
captured.update(
{
"save_dir": kwargs["save_dir"],
# Path, like the other fakes in this file: the relative part is
# forward-slashed on every platform, so a Windows host spells
# the joined value "root\Flux.1 D/fantasy" -- comparing strings
# would assert the host separator instead of the routed root.
"save_dir": Path(kwargs["save_dir"]),
"relative_path": kwargs["relative_path"],
"model_type": kwargs["model_type"],
}
@@ -2435,7 +2439,7 @@ async def test_download_root_rule_routes_lora_to_rule_root(
assert result["success"] is True
assert captured["model_type"] == "lora"
assert captured["save_dir"] == str(archive_root / "Flux.1 D" / "fantasy")
assert captured["save_dir"] == archive_root / "Flux.1 D" / "fantasy"
@pytest.mark.asyncio
@@ -2540,7 +2544,7 @@ async def test_download_root_rule_applies_to_final_unet_type(
assert result["success"] is True
assert captured["model_type"] == "checkpoint"
assert captured["save_dir"] == str(unet_archive / "Flux.1 D" / "fantasy")
assert captured["save_dir"] == unet_archive / "Flux.1 D" / "fantasy"
@pytest.mark.asyncio