|
42 | 42 | ReadDirectoryParams, |
43 | 43 | ReadDirectoryRequest, |
44 | 44 | ReadDirectoryResult, |
| 45 | + Skill, |
45 | 46 | ) |
46 | 47 |
|
47 | 48 | pytestmark = pytest.mark.anyio |
@@ -88,6 +89,12 @@ def _digest(data: bytes) -> str: |
88 | 89 | return f"sha256:{hashlib.sha256(data).hexdigest()}" |
89 | 90 |
|
90 | 91 |
|
| 92 | +async def _listed(catalog: SkillCatalog) -> list[Skill]: |
| 93 | + server = MCPServer("skills", extensions=[catalog]) |
| 94 | + async with Client(server, extensions=[ClientSkills()]) as client: |
| 95 | + return list(await client.extension(ClientSkills).list_skills()) |
| 96 | + |
| 97 | + |
91 | 98 | async def _server(files: Mapping[str, bytes], **options: Any) -> MCPServer: |
92 | 99 | catalog = await SkillCatalog.load(_MemoryProvider(files), parse_frontmatter=_parse, **options) |
93 | 100 | return MCPServer("skills", extensions=[catalog]) |
@@ -283,7 +290,7 @@ async def list_files(self) -> Sequence[str]: |
283 | 290 | catalog = await SkillCatalog.load( |
284 | 291 | GeneratorProvider({"git-workflow/SKILL.md": _skill_md("git-workflow")}), parse_frontmatter=_parse |
285 | 292 | ) |
286 | | - assert [skill.uri for skill in catalog.skills] == ["skill://git-workflow/SKILL.md"] |
| 293 | + assert [skill.uri for skill in await _listed(catalog)] == ["skill://git-workflow/SKILL.md"] |
287 | 294 |
|
288 | 295 |
|
289 | 296 | async def test_strict_load_raises_one_error_naming_every_invalid_skill() -> None: |
@@ -345,7 +352,7 @@ def parse_with_date(text: str) -> Mapping[str, Any]: |
345 | 352 | catalog = await SkillCatalog.load( |
346 | 353 | _MemoryProvider({"git-workflow/SKILL.md": _skill_md("git-workflow")}), parse_frontmatter=parse_with_date |
347 | 354 | ) |
348 | | - assert catalog.skills[0].frontmatter == { |
| 355 | + assert (await _listed(catalog))[0].frontmatter == { |
349 | 356 | "name": "git-workflow", |
350 | 357 | "description": "d", |
351 | 358 | "released": "2026-07-28", |
@@ -450,7 +457,7 @@ async def test_a_skill_over_the_recommended_limits_is_still_served_with_a_warnin |
450 | 457 | with caplog.at_level(logging.WARNING, logger=CATALOG_LOGGER): |
451 | 458 | catalog = await SkillCatalog.load(_MemoryProvider(files), parse_frontmatter=_parse) |
452 | 459 |
|
453 | | - assert [skill.uri for skill in catalog.skills] == ["skill://big/SKILL.md"] |
| 460 | + assert [skill.uri for skill in await _listed(catalog)] == ["skill://big/SKILL.md"] |
454 | 461 | assert len([record for record in caplog.records if "skill://big/SKILL.md" in record.getMessage()]) == 2 |
455 | 462 |
|
456 | 463 |
|
|
0 commit comments