Skip to main content

test-writer

How to write pytest tests for modules in this workspace. Load whenever you are about to write or extend tests.

跳到安装

来源信息

仓库
genkit-ai/genkit
最近来源活动
2026年6月4日 02:15
检测到的 SKILL.md 语言
英语
星标
6,448
分支
842

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
test-writer
description
How to write pytest tests for modules in this workspace. Load whenever you are about to write or extend tests.
# Test writer When writing pytest tests in this workspace: - **One test file per module.** `foo.py` lives next to `foo_test.py` (suffix, not prefix). - **Cover the happy path AND at least one edge case.** Empty input, duplicates, boundary values — pick what matters for the unit under test. - **Use `pytest.mark.parametrize`** when the same assertion runs over a small table of inputs. Keep IDs descriptive. - **Name tests `test_<unit>_<scenario>_<expected>`.** Examples: `test_total_empty_cart_returns_zero`, `test_add_duplicate_item_merges_quantities`. - **Arrange / Act / Assert.** Three clear blocks. No setup hidden in fixtures unless it's reused across at least two tests. - **Assert behavior, not implementation.** Don't reach into private attributes or count function calls; check the observable result. - **Imports at module top.** Don't import inside test functions.
在 GitHub 查看