From d4a01c8d6d586b3a4339d64dcda34f0a225fa491 Mon Sep 17 00:00:00 2001 From: Will Miao Date: Tue, 13 Oct 2026 11:35:39 +0800 Subject: [PATCH] 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. --- tests/services/test_download_manager_basic.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/services/test_download_manager_basic.py b/tests/services/test_download_manager_basic.py index 168f9a75..ac34cb3f 100644 --- a/tests/services/test_download_manager_basic.py +++ b/tests/services/test_download_manager_basic.py @@ -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