You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copier Template: Claude Commands: Split test development into planning and implementation phases.
Split cs-develop-tests.md into two commands: cs-plan-tests.md for coverage analysis
and test planning, and cs-develop-tests.md for implementing tests from existing plans.
This prevents eager Claudes from rushing to implementation without proper analysis.
Updated documentation/common/tests.rst with:
- Test data directory structure (tests/data/)
- Network testing prohibition with httpx MockTransport example
- Module vs function numbering warning
- Subpackage naming conventions
- tests/README.md maintenance requirements
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Have verified access to target code modules referenced in the plan
35
+
- Have read any relevant `CLAUDE.md` file
36
+
- Understand the [test-writing guidelines](https://raw.githubusercontent.com/emcd/python-project-common/refs/tags/docs-1/documentation/common/tests.rst)
37
37
38
38
## Testing Principles (from project guidelines)
39
39
@@ -62,97 +62,122 @@ Ensure that you:
62
62
**CRITICAL**: You MUST halt the process and consult with the user if ANY of the
63
63
following occur:
64
64
65
-
-**Anti-Pattern Detection**: If proposed tests violate project principles
66
-
-**Coverage Regression**: If tests would reduce existing coverage
65
+
-**Plan Deviation**: If implementation cannot follow the test plan as specified
66
+
-**Anti-Pattern Detection**: If plan requires tests that violate project principles
67
67
-**Architecture Conflicts**: If tests require monkey-patching internal code
68
-
-**Numbering Conflicts**: If test numbering clashes with existing conventions
69
-
-**Missing Dependencies**: If required test fixtures or dependencies are
70
-
unavailable
68
+
-**Numbering Conflicts**: If planned test numbering clashes with existing conventions
69
+
-**Missing Dependencies**: If required test fixtures or dependencies are unavailable
70
+
-**Plan Inconsistencies**: If the test plan contains contradictions or unclear instructions
71
71
72
72
**Your responsibilities:**
73
-
- Follow project style and test-writing conventions exactly.
74
-
- Use dependency injection patterns consistently.
75
-
- Prefer pyfakefs for filesystem operations.
76
-
- Maintain systematic test numbering.
77
-
- Ensure tests validate behavior, not implementation.
73
+
- Follow the test plan precisely while adhering to project conventions
74
+
- Use dependency injection patterns as specified in the plan
75
+
- Implement tests exactly as planned without adding extras
76
+
- Maintain systematic test numbering as outlined in the plan
77
+
- Ensure tests validate behavior, not implementation
78
+
- Document any necessary deviations from the plan with clear justification
78
79
79
-
## Test Writing Process
80
+
## Test Implementation Process
80
81
81
-
Execute the following steps for test requirements: `$ARGUMENTS`
82
+
Execute the following steps for test plan: `$ARGUMENTS`
82
83
83
84
### 0. Pre-Flight Verification
84
-
**MANDATORY - Verify access to test-writing guide:**
85
+
**MANDATORY - Verify access to project guidelines:**
85
86
86
-
Use WebFetch to access and confirm you can read the complete testing
-**Feature-Specific Tests (100+ blocks):** Each public function/class gets its own 100-block with normal usage patterns, edge cases, and error handling
120
-
-**Integration Tests (higher numbers):** Cross-module interactions and end-to-end workflows
129
+
**Create required test data under tests/data/:**
130
+
-Set up fake packages for extension mechanisms (if planned)
131
+
-Prepare captured artifacts and snapshots (if planned)
132
+
-Create any mock data files as specified in the plan
121
133
122
-
### 3. Test Implementation
123
-
Create tests following project conventions:
134
+
**CRITICAL**: Only create test data explicitly mentioned in the test plan.
135
+
136
+
### 4. Test Module Creation/Updates
137
+
**Implement test modules following the plan:**
138
+
139
+
**For each planned test module:**
140
+
- Create or update test files with planned naming (e.g., `test_100_exceptions.py`)
141
+
- Follow planned test function numbering within modules
142
+
- Implement only the tests specified in the plan
143
+
- Use dependency injection patterns as outlined in the plan
124
144
125
145
**Key Implementation Guidelines:**
126
-
- Use dependency injection for all external dependencies
127
-
- Prefer `pyfakefs.Patcher()` for filesystem operations
146
+
- Use dependency injection for all external dependencies as planned
147
+
- Prefer `pyfakefs.Patcher()` for filesystem operations as specified
128
148
- Mock only third-party services, never internal code
129
-
- Include docstrings explaining what behavior is tested
149
+
-**Insert tests in numerical order within files** - do NOT append to end
150
+
-**Write behavior-focused docstrings**: "Functionality is correct with Y" NOT "function_name does X with Y"
130
151
- Follow existing naming conventions and code style
152
+
- Implement tests in the exact order and numbering specified in the plan
131
153
132
154
### 5. Coverage Validation
133
-
Verify tests improve coverage without regressions:
155
+
**Verify implementation matches plan coverage goals:**
134
156
```bash
135
157
hatch --env develop run testers
136
158
hatch --env develop run coverage report --show-missing
0 commit comments