用途:为 Python 插件统一 pytest 配置与测试基础设施,覆盖配置、fixture、标记与 CI 集成。
主要能力:提供 pyproject.toml 的 pytest 与 coverage 配置模板,包括 testpaths、python_files、addopts(-v、--cov=src、--cov-report=term-missing、--cov-fail-under=80、--strict-markers)及 unit、integration、slow 标记;提供 conftest.py 模板、fixture、测试标记与目录结构;提供 GitRepository 辅助类用于测试 git 工作流;提供 Bash、TodoWrite 等工具的 mock fixture;提供 GitHub Actions 工作流与测试命令。
使用方式:在 pyproject.toml 中写入 [tool.pytest.ini_options] 与 [tool.coverage.run]/[tool.coverage.report] 配置;用 pytest --collect-only 验证用例发现,pytest -v --co -q 检查标记,pytest --cov 检查覆盖率阈值。可在技能 frontmatter 中引用依赖,如 dependencies: [leyline:pytest-config, leyline:testing-quality-standards]。
适用场景:Python 插件测试配置搭建与审计,被 python-testing、test-review、test-* 等技能引用。
限制:不适用于非 Python 项目或使用其他测试框架的项目,也不适用于无需测试基础设施的简单脚本。异步测试需安装 pytest-asyncio 并使用 @pytest.mark.asyncio;导入错误需检查 PYTHONPATH 或 pip install -e .。具体价格、平台支持等暂未提供。