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:
Will Miao
2026-10-12 11:46:13 +08:00
parent c16de68640
commit d25f170ffe
7 changed files with 33 additions and 25 deletions
+11 -5
View File
@@ -36,6 +36,12 @@ def _normalize(path) -> str:
return os.path.normpath(str(path)).replace(os.sep, "/")
def _fold(paths):
"""Compare path lists as identities: the code may hand out either spelling."""
return [_normalize(path) for path in paths]
class TestAppendNewPaths:
def test_appends_without_reordering_or_duplicating(self):
merged = config_module._append_new_paths(
@@ -60,17 +66,17 @@ class TestAdmitConfiguredRoots:
loras_roots=[str(primary)],
_configured_root_paths={"lora": [str(primary), str(drive)]},
)
assert config.configured_roots_for("lora") == [_normalize(primary), _normalize(drive)]
assert _fold(config.configured_roots_for("lora")) == _fold([primary, drive])
# Still switched off: nothing to admit.
assert config.admit_configured_roots() == []
assert config.loras_roots == [_normalize(primary)]
assert _fold(config.loras_roots) == _fold([primary])
drive.mkdir(parents=True)
admitted = config.admit_configured_roots()
assert admitted == [_normalize(drive)]
assert config.loras_roots == [_normalize(primary), _normalize(drive)]
assert _fold(admitted) == _fold([drive])
assert _fold(config.loras_roots) == _fold([primary, drive])
# Idempotent: a second call adds nothing.
assert config.admit_configured_roots() == []
@@ -91,7 +97,7 @@ class TestAdmitConfiguredRoots:
drive.rmdir()
config.admit_configured_roots()
assert config.loras_roots == [_normalize(primary), _normalize(drive)]
assert _fold(config.loras_roots) == _fold([primary, drive])
def test_admits_every_model_type_and_its_side_maps(self, tmp_path):
checkpoint_dir = tmp_path / "checkpoints"