Agent Skills › PrefectHQ/fastmcp › python-tests

python-tests

GitHub

为 FastMCP 变更编写回归测试,利用 pytest fixtures、内存客户端和协议边界。涵盖异步测试配置、外部边界模拟、HTTP 传输处理及快照断言规范。

.agents/skills/python-tests/SKILL.md PrefectHQ/fastmcp

Trigger Scenarios

需要为 FastMCP 功能或修复编写单元测试 验证 MCP 协议交互或网络行为

Install

npx skills add PrefectHQ/fastmcp --skill python-tests -g -y
More Options

Non-standard path

npx skills add https://github.com/PrefectHQ/fastmcp/tree/main/.agents/skills/python-tests -g -y

Use without installing

npx skills use PrefectHQ/fastmcp@python-tests

指定 Agent (Claude Code)

npx skills add PrefectHQ/fastmcp --skill python-tests -a claude-code -g -y

安装 repo 全部 skill

npx skills add PrefectHQ/fastmcp --all -g -y

预览 repo 内 skill

npx skills add PrefectHQ/fastmcp --list

SKILL.md

Frontmatter
{
    "name": "python-tests",
    "description": "Write regression tests for FastMCP changes using its pytest fixtures, in-memory clients, and protocol boundaries."
}

FastMCP tests

Read nearby tests and the repository's validation requirements first. Extend the owning test module when it remains readable; use a focused module when the existing one is already too large.

For a bug fix, run the regression against unchanged code and confirm it fails for the reported reason, then run it with the fix. An import error or broken fixture is not a reproduced bug. Include supported adjacent behavior that the same branch could change, especially omitted defaults and explicit overrides.

  • Async tests need no marker: asyncio_mode = "auto" is configured globally.
  • Use Client(server) for real MCP dispatch without a network server. Use HTTP transport only when network behavior is the subject.
  • Mock external boundaries, not the FastMCP functions under test. For OpenAPI requests, capture the outgoing request with httpx2.MockTransport and assert its bytes, headers, or decoded parameters.
  • Keep imports at module scope. Prefer function-scoped fixtures and tmp_path for files.
  • Parameterize variations of one contract; separate unrelated behavior. For JSON, equality alone does not distinguish True from 1: check the resulting type when type preservation matters.
  • Use existing inline_snapshot conventions for complex schema assertions. Inspect generated snapshots rather than accepting them blindly.
  • The default timeout is five seconds. Use the repository's integration conventions for tests that legitimately need more time.

Run focused tests during development, then the full commands required by AGENTS.md before committing. If a failure appears unrelated, reproduce it on the unchanged base; do not call it pre-existing from the test name alone.

Version History

  • c6165d9 Current 2026-09-23 08:38

Same Skill Collection

.agents/skills/code-review/SKILL.md
.agents/skills/docs/SKILL.md
.agents/skills/fix-issue/SKILL.md
.agents/skills/release/SKILL.md
.agents/skills/review-issue/SKILL.md
.agents/skills/review-pr/SKILL.md
.agents/skills/review-security-report/SKILL.md
.agents/skills/triage/SKILL.md
.claude/skills/code-review/SKILL.md
.claude/skills/python-tests/SKILL.md
.claude/skills/review-issue/SKILL.md
.claude/skills/review-pr/SKILL.md
.claude/skills/review-security-report/SKILL.md
examples/skills/sample_skills/code-review/SKILL.md
examples/skills/sample_skills/pdf-processing/SKILL.md
skills/fastmcp-client-cli/SKILL.md

Metadata

Files
0
Version
c6165d9
Hash
8fd61fdb
Indexed
2026-09-23 08:38

Home - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-26 07:14
浙ICP备14020137号-1