pywf-oss-write-test
Write, extend, or fix the unit tests for a module of a pywf open-source Python library, following the source-to-test mapping and run_cov_test conventions, until that module is fully covered. Use when
SKILL.md.claude/skills/pywf-oss-write-test/SKILL.md
GitHubWrite the tests for one module (or every module of one subpackage) until its own test file reports full coverage and mise run cov passes.
Read ../pywf-oss-base/SKILL.md, then:
- ../pywf-oss-base/references/09-code-style.md
- ../pywf-oss-base/references/10-test-layout.md
- ../pywf-oss-base/references/11-test-writing.md
- ../pywf-oss-base/references/12-coverage.md
Steps
- Locate.
- Read the source module.
- Get its
<test_path>frompython ${CLAUDE_SKILL_DIR}/../pywf-oss-base/scripts/check_test_layout.py --project_root . --source <source_path>. - If the test file is missing, create it there from the template in
11-test-writing.md, never elsewhere.
- Baseline. Run
.venv/bin/python <test_path>, and note the missing lines in theterm-missingreport. - Write the tests, following
11-test-writing.md. - Close the gaps.
- Rerun until the module is at 100%.
- A line that truly cannot run in unit tests may get
# pragma: no cover, only under12-coverage.mdsection 3. - Never change the source just to ease coverage without telling the user.
- Finish.
mise run covpasses, the layout check without--sourcereports 0 problems, andmise run format, thenmise run lint, reports nothing.
Boundaries
- If a test reveals a bug in the source, stop and report it with the failing test as evidence. Fix the source only after the user's yes, or if the user asked for fixes.
- Edit a
run_cov_testblock only to correct its module path. Keep one argument per line.
Next step: pywf-oss-write-doc if the feature is user-facing, otherwise pywf-oss-changelog.