chore(skills): clean up PR #862 — simplify manifest guard, DRY up tests

Follow-up to PR #862 (local skills classification by arceus77-7):

- Remove unnecessary isinstance guard on _read_manifest() return value —
  it always returns Dict[str, str], so set() on it suffices.
- Extract repeated hub-dir monkeypatching into a shared pytest fixture (hub_env).
- Add three_source_env fixture for source-classification tests.
- Add _read_manifest monkeypatch to test_do_list_initializes_hub_dir
  (was fragile — relied on empty skills list masking the real manifest).
- Add test coverage for --source hub and --source builtin filters.
- Extract _capture() helper to reduce console/StringIO boilerplate.

5 tests, all green.
This commit is contained in:
teknium1
2026-03-12 08:08:22 -07:00
parent 7e637d3b6a
commit bb7cdc6d44
2 changed files with 79 additions and 74 deletions

View File

@@ -416,8 +416,7 @@ def do_list(source_filter: str = "all", console: Optional[Console] = None) -> No
ensure_hub_dirs()
lock = HubLockFile()
hub_installed = {e["name"]: e for e in lock.list_installed()}
bundled_manifest = _read_manifest()
builtin_names = set(bundled_manifest.keys()) if isinstance(bundled_manifest, dict) else set()
builtin_names = set(_read_manifest())
all_skills = _find_all_skills()