tests/test_check_deps.py
tests/test_check_deps.pyBrowse 33 files
552 tokens
2,362 bytes
Token encoding: o200k_base
Snapshot 24fd22b
← Back to SKILL.md
1"""Tests for check_deps.py — focuses on parsing logic that doesn't need a server."""2 3from __future__ import annotations4 5from check_deps import (6 NODE_TO_PACKAGE,7 model_present,8 normalize_for_match,9 suggest_install_command,10)11 12 13class TestNormalizeForMatch:14 def test_basic(self):15 s = normalize_for_match("model.safetensors")16 assert "model.safetensors" in s17 assert "model" in s18 19 def test_subfolder(self):20 s = normalize_for_match("subdir/model.pt")21 assert "subdir/model.pt" in s22 assert "model.pt" in s23 assert "model" in s24 25 26class TestModelPresent:27 def test_exact_match(self):28 assert model_present("a.safetensors", {"a.safetensors", "b.safetensors"}) is True29 30 def test_extension_difference(self):31 # User said "model" but installed is "model.safetensors"32 assert model_present("model", {"model.safetensors"}) is True33 # Reverse direction — also matches34 assert model_present("model.safetensors", {"model"}) is True35 36 def test_subfolder_match(self):37 # Installed list has "subdir/model.safetensors", workflow asks "model.safetensors"38 assert model_present("model.safetensors", {"subdir/model.safetensors"}) is True39 40 def test_missing(self):41 assert model_present("missing.safetensors", {"a.safetensors", "b.safetensors"}) is False42 43 def test_empty_installed(self):44 assert model_present("anything.safetensors", set()) is False45 46 47class TestSuggestInstallCommand:48 def test_known_node(self):49 cmd = suggest_install_command("VHS_VideoCombine")50 assert cmd == "comfy node install comfyui-videohelpersuite"51 52 def test_unknown_node(self):53 assert suggest_install_command("SomeRandomNodeName123") is None54 55 56class TestNodePackageMap:57 def test_no_duplicates(self):58 # Each node should map to exactly one package59 keys = list(NODE_TO_PACKAGE.keys())60 assert len(keys) == len(set(keys))61 62 def test_packages_are_safe_for_shell(self):63 # Registry slugs must be alphanumerics + hyphens/underscores only64 # (passed straight to `comfy node install <pkg>`).65 import re66 safe = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._\-]*$")67 for pkg in NODE_TO_PACKAGE.values():68 assert safe.match(pkg), f"Unsafe package slug: {pkg!r}"69