pytest-patterns
✓使用 pytest 對 FastAPI 應用程序進行 Python 後端測試模式。編寫 Python 測試時使用:服務和存儲庫的單元測試、使用 httpx.AsyncClient 對 API 端點進行集成測試、夾具創建、使用factory_boy 進行工廠設置、使用 pytest-asyncio 進行異步測試、模擬策略和參數化測試。涵蓋測試組織(測試/單元、測試/集成)、conftest 層次結構和覆蓋率要求。不涵蓋前端測試(使用react-testing-patterns)或E2E瀏覽器測試(使用e2e-testing)。
SKILL.md
Run subsets: pytest -m unit, pytest -m integration, pytest -m "not slow".
Fixtures cascade: root conftest.py provides shared fixtures; subdirectory conftest files add layer-specific fixtures.
| function (default) | Isolated per-test data | dbsession, sampleuser | | class | Shared across test class | serviceinstance | | module | Shared across test file | seededdatabase | | session | Shared across entire run | engine, anyiobackend |
使用 pytest 對 FastAPI 應用程序進行 Python 後端測試模式。編寫 Python 測試時使用:服務和存儲庫的單元測試、使用 httpx.AsyncClient 對 API 端點進行集成測試、夾具創建、使用factory_boy 進行工廠設置、使用 pytest-asyncio 進行異步測試、模擬策略和參數化測試。涵蓋測試組織(測試/單元、測試/集成)、conftest 層次結構和覆蓋率要求。不涵蓋前端測試(使用react-testing-patterns)或E2E瀏覽器測試(使用e2e-testing)。 來源:hieutrtr/ai1-skills。
可引用資訊
為搜尋與 AI 引用準備的穩定欄位與指令。
- 安裝指令
npx skills add https://github.com/hieutrtr/ai1-skills --skill pytest-patterns- 分類
- </>開發工具
- 認證
- ✓
- 收錄時間
- 2026-02-05
- 更新時間
- 2026-02-18
快速解答
什麼是 pytest-patterns?
使用 pytest 對 FastAPI 應用程序進行 Python 後端測試模式。編寫 Python 測試時使用:服務和存儲庫的單元測試、使用 httpx.AsyncClient 對 API 端點進行集成測試、夾具創建、使用factory_boy 進行工廠設置、使用 pytest-asyncio 進行異步測試、模擬策略和參數化測試。涵蓋測試組織(測試/單元、測試/集成)、conftest 層次結構和覆蓋率要求。不涵蓋前端測試(使用react-testing-patterns)或E2E瀏覽器測試(使用e2e-testing)。 來源:hieutrtr/ai1-skills。
如何安裝 pytest-patterns?
開啟你的終端機或命令列工具(如 Terminal、iTerm、Windows Terminal 等) 複製並執行以下指令:npx skills add https://github.com/hieutrtr/ai1-skills --skill pytest-patterns 安裝完成後,技能將自動設定到你的 AI 程式設計環境中,可以在 Claude Code 或 Cursor 中使用
這個 Skill 的原始碼在哪?
https://github.com/hieutrtr/ai1-skills
詳情
- 分類
- </>開發工具
- 來源
- skills.sh
- 收錄時間
- 2026-02-05