Test creation

From docxology/template · View interactive version

Test creation is an AI agent skill from the GitHub repository docxology/template. Create pytest suites under the no-mocks policy — real data, temp files, subprocess, pytest-httpserver. USE WHEN adding tests, raising coverage, testing new src/ module, or user forbids mocks.

How to use this skill

Skill file

Test creation

Natural invoke

Inputs to confirm

Workflow

  1. No mocks — never unittest.mock, MagicMock, or patch the unit under test. Use real computation, tmp_path, local HTTP servers, subprocess for CLIs.
  1. Structure — test_*.py mirroring src modules; parametrize variants; fixed RNG seeds.
  1. Coverage — run pytest-cov; meet floor for layer.
  1. Integration — wire into projects/<n>/tests/ or tests/infra_tests/ following existing layout.

Deliverables

Verification commands

uv run pytest path/to/test_file.py -v
uv run pytest projects/<project>/tests/ --cov=projects/<project>/src --cov-fail-under=90
uv run pytest tests/infra_tests/path/ --cov=infrastructure --cov-fail-under=60

When NOT to use

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.