Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/luohaothu-python-testing
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: testing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/python-testing
What's inside
- Skill name
python-testing- Description
- 使用pytest、TDD方法、夹具、模拟、参数化和覆盖率要求的Python测试策略。
- License
- MIT
- Instructions
- 812 lines in SKILL.md · view on GitHub
Before installing
- Instructions call the network
Agent Skills spec issues
- body: 812 lines (spec recommends under 500)
Files (1)
- SKILL.md
SKILL.md (first lines)
# Python 测试模式
使用 pytest、TDD 方法论和最佳实践的 Python 应用程序全面测试策略。
## 何时激活
* 编写新的 Python 代码(遵循 TDD:红、绿、重构)
* 为 Python 项目设计测试套件
* 审查 Python 测试覆盖率
* 设置测试基础设施
## 核心测试理念
### 测试驱动开发 (TDD)
始终遵循 TDD 循环:
1. **红**:为期望的行为编写一个失败的测试
2. **绿**:编写最少的代码使测试通过
3. **重构**:在保持测试通过的同时改进代码
```python
# Step 1: Write failing test (RED)
def test_add_numbers():
result = add(2, 3)
assert result == 5
# Step 2: Write minimal implementation (GREEN)
def add(a, b):
return a + b
# Step 3: Refactor if needed (REFACTOR)
```
### 覆盖率要求
* **目标**:80%+ 代码覆盖率
* **关键路径**:需要 100% 覆盖率
* 使用 `pytest --cov` 来测量覆盖率
```bash
pytest --cov=mypackage --cov-report=term-missing --cov-report=html
```
## pytest 基础
### 基本测试结构
```python
import pytest
def test_addition():
"""Test basic addition."""
assert 2 + 2 == 4
def test_string_uppercase():
"""Test string uppercasing."""
text = "hello"
assert text.upper() == "HELLO"
def test_list_append():
"""Test list append."""
items = [1, 2, 3]
items.append(4)
assert 4 in items
assert len(items) == 4
```
### 断言
```python
# Equality
assert result == expected
# Inequality
assert result != unexpected
# Truthiness
assert result # Truthy
assert not result # Falsy
assert result is True # Exactly True
assert result is False # Exactly False
assert result is None # Exactly None
# Membership
assert item in collection
assert item not in collection
# Comparisons
assert result > 0
assert 0 <= result <= 100
# Type checking
assert isinstance(result, str)
# Exception testing (preferred approach)
with pytest.raises(ValueError):
raise ValueError("error message")
# Check exception message
with pytest.raises(ValueError, match="invalid input"):
raise ValueError("invalid input provided")
# Check exception attributes
with pytest.raises(ValueError) as exc_info:
raise ValueError("error message")
assert str(exc_info.value) == "error message"
```
## 夹具
### 基本夹具使用
```python
import pytest
@pytest.fixture
def sample_data():
"""Fixture providing sample data."""From Luohaothu/everything-codex, MIT.
More from Luohaothu/everything-codex
- 0.493score
architect
Luohaothu
Software architecture specialist for system design, scalability, and technical decision-making.
SkillDFreshness: D★ 26Claude Code +9 - 0.493score
build-fix
Luohaothu
Build and compilation error resolution specialist.
SkillDFreshness: D★ 26Claude Code +9 - 0.490score
code-review
Luohaothu
Expert code review for quality, security, and maintainability.
SkillDFreshness: D★ 26Claude Code +9 - 0.490score
checkpoint
Luohaothu
Create or verify workflow checkpoints using git commits and state tracking.
SkillDFreshness: D★ 26Claude Code +9 - 0.487score
tdd-workflow
Luohaothu
在编写新功能、修复错误或重构代码时使用此技能。强制执行测试驱动开发,包含单元测试、集成测试和端到端测试,覆盖率超过80%。
SkillDFreshness: D★ 26Claude Code +9 - 0.487score
springboot-patterns
Luohaothu
Spring Boot 架构模式、REST API 设计、分层服务、数据访问、缓存、异步处理和日志记录。适用于 Java Spring Boot 后端工作。
SkillDFreshness: D★ 26Claude Code +9 - 0.487score
springboot-tdd
Luohaothu
使用JUnit 5、Mockito、MockMvc、Testcontainers和JaCoCo进行Spring Boot的测试驱动开发。适用于添加功能、修复错误或重构时。
SkillDFreshness: D★ 26Claude Code +9 - 0.487score
springboot-security
Luohaothu
Java Spring Boot 服务中关于身份验证/授权、验证、CSRF、密钥、标头、速率限制和依赖安全的 Spring Security 最佳实践。
SkillDFreshness: D★ 26Claude Code +9 - 0.484score
jpa-patterns
Luohaothu
Spring Boot中的JPA/Hibernate实体设计、关系、查询优化、事务、审计、索引、分页和连接池模式。
SkillDFreshness: D★ 26Claude Code +9 - 0.484score
postgres-patterns
Luohaothu
基于Supabase最佳实践的PostgreSQL数据库模式,用于查询优化、架构设计、索引和安全。
SkillDFreshness: D★ 26Claude Code +9 - 0.484score
eval-harness
Luohaothu
克劳德代码会话的正式评估框架,实施评估驱动开发(EDD)原则
SkillDFreshness: D★ 26Claude Code +9 - 0.484score
continuous-learning-v2
Luohaothu
基于本能的学习系统,通过钩子观察会话,创建具有置信度评分的原子本能,并将其演化为技能/命令/代理。
SkillDFreshness: D★ 26Claude Code +9
Signals
- Stars
- 26
- Forks
- 5
- Open issues
- 0
- Last commit (this folder)
- Feb 5, 2026 (8 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/Luohaothu/everything-codex
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from Luohaothu
- 0.493score
architect
Luohaothu
Software architecture specialist for system design, scalability, and technical decision-making.
SkillDFreshness: D★ 26Claude Code +9 - 0.493score
build-fix
Luohaothu
Build and compilation error resolution specialist.
SkillDFreshness: D★ 26Claude Code +9 - 0.490score
checkpoint
Luohaothu
Create or verify workflow checkpoints using git commits and state tracking.
SkillDFreshness: D★ 26Claude Code +9 - 0.490score
code-review
Luohaothu
Expert code review for quality, security, and maintainability.
SkillDFreshness: D★ 26Claude Code +9 - 0.487score
springboot-patterns
Luohaothu
Spring Boot 架构模式、REST API 设计、分层服务、数据访问、缓存、异步处理和日志记录。适用于 Java Spring Boot 后端工作。
SkillDFreshness: D★ 26Claude Code +9 - 0.487score
springboot-security
Luohaothu
Java Spring Boot 服务中关于身份验证/授权、验证、CSRF、密钥、标头、速率限制和依赖安全的 Spring Security 最佳实践。
SkillDFreshness: D★ 26Claude Code +9
Cite this page
python-testing skill. Agent Mart. https://agentmart.dev/skills/luohaothu-python-testing (last updated 2026-10-24)