一键导入
python-testing
DeepSearch pytest guide for targeted tests, fixtures, async mocks, live-test gates, and artifact-safe test data.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
DeepSearch pytest guide for targeted tests, fixtures, async mocks, live-test gates, and artifact-safe test data.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
DeepSearch Python patterns for layering, config models, custom exceptions, logging, path safety, prompts, and async cleanup.
Security review checklist for DeepSearch changes involving secrets, file paths, LLM/search providers, prompts, server APIs, storage, and logs.
Verify DeepSearch changes with scoped diff review, import checks, pytest, optional live tests, and artifact hygiene.
| name | python-testing |
| description | DeepSearch pytest guide for targeted tests, fixtures, async mocks, live-test gates, and artifact-safe test data. |
Use this when adding or updating DeepSearch tests.
uv run pytest tests/path/to/test_file.py
uv run pytest -m "not llm"
RUN_LLM_TESTS=1 uv run pytest -m llm
Run live tests only when explicitly requested and credentials are configured.
conftest.py.tmp_path for generated reports, markdown/html/docx files, logs, and databases.monkeypatch for environment variables and runtime config.AsyncMock for async LLM/search calls.Pytest uses strict asyncio mode. Mark async tests explicitly and ensure background tasks are awaited or cancelled.
import pytest
from unittest.mock import AsyncMock
@pytest.mark.asyncio
async def test_node_uses_llm(monkeypatch):
fake_call = AsyncMock(return_value={"result": "ok"})
monkeypatch.setattr("module.path.call_llm", fake_call)
result = await run_node()
assert result["result"] == "ok"
fake_call.assert_awaited_once()
@pytest.mark.llm.RUN_LLM_TESTS=1.uv run pytest.