Files
qwenpaw/tests/integration/test_skill_system_module.py
agent-radar 1a3a4ccde1
Creator App Tests / PR Spam Gate (push) Skipped
Frontend Tests / PR Spam Gate (push) Skipped
NPM Format (website & console) / PR Spam Gate (push) Skipped
Pre-commit Checks / PR Spam Gate (push) Skipped
QwenPaw Creator Plugin Release / check-version (push) Canceled after 0s
QwenPaw Creator Plugin Release / upload-oss (push) Canceled after 0s
Tests / PR Spam Gate (push) Skipped
CodeQL / CodeQL (python) (push) Canceled after 0s
CodeQL / CodeQL (typescript) (push) Canceled after 0s
Creator App Tests / Creator Backend Tests (push) Canceled after 0s
Creator App Tests / Creator UI Build & Tests (push) Canceled after 0s
E2E Smoke Tests / Playwright UI Smoke (push) Canceled after 0s
Frontend Tests / Detect console changes (push) Canceled after 0s
NPM Format (website & console) / website format check (push) Canceled after 0s
NPM Format (website & console) / console format check (push) Canceled after 0s
Pre-commit Checks / Pre-commit (push) Canceled after 0s
QwenPaw Data Plugin Release / check-version (push) Canceled after 0s
Tests / Detect code changes (push) Canceled after 0s
Frontend Tests / Vitest Unit Tests (push) Canceled after 0s
Frontend Tests / Frontend Summary (push) Canceled after 0s
QwenPaw Data Plugin Release / upload-oss (push) Canceled after 0s
Tests / Maintainer Approval (push) Canceled after 0s
Tests / Unit Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - fallback (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p2 (push) Canceled after 0s
Tests / Coverage Report (push) Canceled after 0s
Tests / Test Summary (push) Canceled after 0s
源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
2026-09-01 20:01:50 +08:00

162 lines
4.7 KiB
Python

# -*- coding: utf-8 -*-
"""Integration tests for the skill_system module internals.
Covers src/qwenpaw/agents/skill_system/* (store, registry,
pool_service, workspace_service) — Plugins module, 2,366 uncovered
lines.
"""
from __future__ import annotations
from pathlib import Path
import pytest
# ------------------------------------------------------------------ #
# store path helpers
# ------------------------------------------------------------------ #
@pytest.mark.integration
@pytest.mark.p1
def test_store_pool_dir_exists() -> None:
"""get_skill_pool_dir returns an existing directory."""
from qwenpaw.agents.skill_system.store import get_skill_pool_dir
pool_dir = get_skill_pool_dir()
assert isinstance(pool_dir, Path)
@pytest.mark.integration
@pytest.mark.p1
def test_store_workspace_skills_dir(tmp_path) -> None:
"""get_workspace_skills_dir prefers the skills/ subdirectory."""
from qwenpaw.agents.skill_system.store import (
get_workspace_skills_dir,
)
skills_dir = get_workspace_skills_dir(tmp_path)
assert skills_dir == tmp_path / "skills"
@pytest.mark.integration
@pytest.mark.p1
def test_store_workspace_manifest_path(tmp_path) -> None:
"""get_workspace_skill_manifest_path points at skill.json."""
from qwenpaw.agents.skill_system.store import (
get_workspace_skill_manifest_path,
)
assert get_workspace_skill_manifest_path(tmp_path) == (
tmp_path / "skill.json"
)
@pytest.mark.integration
@pytest.mark.p1
def test_store_workspace_identity(tmp_path) -> None:
"""get_workspace_identity resolves id + display name."""
from qwenpaw.agents.skill_system.store import get_workspace_identity
identity = get_workspace_identity(tmp_path)
assert isinstance(identity, dict)
assert identity.get("workspace_id") == tmp_path.name
@pytest.mark.integration
@pytest.mark.p1
def test_store_pool_manifest_path() -> None:
"""get_pool_skill_manifest_path lives inside the pool dir."""
from qwenpaw.agents.skill_system.store import (
get_pool_skill_manifest_path,
get_skill_pool_dir,
)
manifest = get_pool_skill_manifest_path()
assert manifest.parent == get_skill_pool_dir()
@pytest.mark.integration
@pytest.mark.p1
def test_store_extra_skill_dirs() -> None:
"""get_extra_skill_dirs returns a list of existing paths."""
from qwenpaw.agents.skill_system.store import get_extra_skill_dirs
dirs = get_extra_skill_dirs()
assert isinstance(dirs, list)
# ------------------------------------------------------------------ #
# registry
# ------------------------------------------------------------------ #
@pytest.mark.integration
@pytest.mark.p1
def test_registry_builtin_language_preference() -> None:
"""builtin language preference get/set round-trips."""
from qwenpaw.agents.skill_system.registry import (
get_builtin_skill_language_preference,
set_builtin_skill_language_preference,
)
original = get_builtin_skill_language_preference()
try:
set_builtin_skill_language_preference("en")
assert get_builtin_skill_language_preference() == "en"
finally:
set_builtin_skill_language_preference(original)
@pytest.mark.integration
@pytest.mark.p1
def test_registry_packaged_builtin_versions() -> None:
"""get_packaged_builtin_versions returns a name->version map."""
from qwenpaw.agents.skill_system.registry import (
get_packaged_builtin_versions,
)
versions = get_packaged_builtin_versions()
assert isinstance(versions, dict)
assert len(versions) > 0
@pytest.mark.integration
@pytest.mark.p1
def test_registry_builtin_skills_dir() -> None:
"""get_builtin_skills_dir returns a directory path."""
from qwenpaw.agents.skill_system.registry import get_builtin_skills_dir
assert isinstance(get_builtin_skills_dir(), Path)
# ------------------------------------------------------------------ #
# pool service
# ------------------------------------------------------------------ #
@pytest.mark.integration
@pytest.mark.p1
def test_pool_service_list_all_skills() -> None:
"""SkillPoolService.list_all_skills returns a list."""
from qwenpaw.agents.skill_system.pool_service import (
SkillPoolService,
)
service = SkillPoolService()
skills = service.list_all_skills()
assert isinstance(skills, list)
@pytest.mark.integration
@pytest.mark.p1
def test_pool_service_delete_nonexistent() -> None:
"""SkillPoolService.delete_skill returns False for unknown name."""
from qwenpaw.agents.skill_system.pool_service import (
SkillPoolService,
)
service = SkillPoolService()
assert service.delete_skill("integ-nonexistent-skill") is False