pytest Powerhouse Testing
Comprehensive rules for building robust, property-based test suites with pytest, Hypothesis, and coverage in Python projects.
# Elite pytest Testing Framework
Claude Code CLI enforces these rules for scalable, production-grade testing using pytest's full ecosystem.
**✅ Core Principles**
- Write tests in `tests/` directory mirroring `src/` structure.
- Aim for 90%+ coverage; use `pytest-cov`.
- Prefer property-based testing with Hypothesis for edge cases.
**🔥 Fixtures & Parametrization**
```python
from pytest import fixture, mark
from hypothesis import given, strategies as st
@fixture
def sample_data():
return {'key': 'value'}
@given(st.integers(), st.text())
def test_property_based(a: int, b: str):
assert len(b) > 0 or a == 0
```
**🚀 Running Tests**
```bash
# With coverage
pytest --cov=src --cov-report=html
# Parallel execution
pytest -n auto
# Hypothesis shrinking
pytest --hypothesis-show-statistics
```
**📊 Plugins to Leverage**
- `pytest-asyncio` for async code.
- `pytest-mock` for mocks.
- `anyio` for multi-runtime testing.
Claude uses its reasoning to generate tests from specs, detect flakiness, and integrate with MCP for CI tool calls.Comments
More Rules
View allGLM-4.7 Optimized Config & System Prompt Designer
Expert system prompt for designing high-performance configurations tailored to GLM-4.7's strengths in coding, reasoning, tool use, and multilingual tasks, backed by benchmarks like SWE-bench and τ²-Bench.
GLM-4.7 Open-Source Coding Expert: Optimized System Prompt
Leverage GLM-4.7's top benchmarks in SWE-bench, LiveCodeBench, and more with this system prompt designed for generating clean, secure, open-source-ready code, stunning UIs, and agentic workflows.
GLM-4.7 Optimized Coding Agent
This system prompt transforms an AI into GLM-4.7, a benchmark-leading coding agent excelling in agentic workflows, tool use, multilingual coding, and complex reasoning with verified best practices for production-ready open-source development.
Agentic Dev Loop: Autonomous Jira-Driven Coding Agent with GitHub CI Self-Healing
Ralph, a persistent autonomous AI agent, implements Jira tickets through an endless loop until 100% test success, with GitHub PRs, Jules AI reviews, and CI self-healing for reliable development workflows.
Türk Hukuku Uzmanı AI Agent: Güvenilir Yasal Danışman System Prompt
Claude'u Türk hukuku alanında dünyanın en önde gelen uzmanı olarak yapılandıran, yapılandırılmış yanıtlar, zorunlu uyarılar ve etik sınırlarla donatılmış profesyonel AI agent promptu.
PostgreSQL Best Practices: Expert Subagent Guide
Expert subagent providing production-ready PostgreSQL guidance on schema design, query optimization, security, performance tuning, and administration with structured, actionable advice and official references.