
Pytest Coverage
Drive pytest line coverage to 100% using annotated coverage reports and targeted test additions.
Overview
pytest-coverage is an agent skill for the Ship phase that runs pytest with annotate coverage, finds uncovered lines, and adds tests until line coverage reaches 100%.
Install
npx skills add https://github.com/github/awesome-copilot --skill pytest-coverageWhat is this skill?
- Runs pytest with --cov and --cov-report=annotate:cov_annotate for per-file annotated coverage
- Supports scoped runs: single module (--cov=your_module_name) or single test file
- cov_annotate mirrors source files; lines prefixed with ! are not covered by tests
- Iterative loop: add tests for ! lines until every file reaches 100% line coverage
- Skips opening annotate files when a module already shows full line coverage
- 100% line coverage target
- annotate report via cov_annotate directory
Adoption & trust: 10.8k installs on skills.sh; 34.6k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You have pytest tests but no systematic way to see which exact lines are untested and close those gaps.
Who is it for?
Python repos where you want agent-guided iteration from a coverage report to full line coverage on specific modules or the whole tree.
Skip if: Projects that only need branch or mutation testing metrics, non-Python stacks, or teams that explicitly cap coverage below 100%.
When should I use this skill?
Run pytest tests with coverage, discover lines missing coverage, and increase coverage to 100%.
What do I get? / Deliverables
You get a cov_annotate-backed view of missing lines and an expanded test suite that covers every line in the targeted modules.
- Updated test files covering previously uncovered lines
- pytest coverage run with annotate output
Recommended Skills
Journey fit
How it compares
Use instead of guessing tests from code reading alone when you already standardize on pytest-cov annotate output.
Common Questions / FAQ
Who is pytest-coverage for?
Solo and indie builders shipping Python libraries, APIs, or CLIs who use pytest and want an agent to follow a concrete annotate-report workflow to 100% line coverage.
When should I use pytest-coverage?
Use it in Ship → testing when you need to run pytest --cov, inspect cov_annotate for ! lines, and add tests until coverage is complete—especially after refactors or before release.
Is pytest-coverage safe to install?
It instructs running local pytest and editing tests; review the Security Audits panel on this page and treat generated tests like any other code you merge.
SKILL.md
READMESKILL.md - Pytest Coverage
The goal is for the tests to cover all lines of code. Generate a coverage report with: pytest --cov --cov-report=annotate:cov_annotate If you are checking for coverage of a specific module, you can specify it like this: pytest --cov=your_module_name --cov-report=annotate:cov_annotate You can also specify specific tests to run, for example: pytest tests/test_your_module.py --cov=your_module_name --cov-report=annotate:cov_annotate Open the cov_annotate directory to view the annotated source code. There will be one file per source file. If a file has 100% source coverage, it means all lines are covered by tests, so you do not need to open the file. For each file that has less than 100% test coverage, find the matching file in cov_annotate and review the file. If a line starts with a ! (exclamation mark), it means that the line is not covered by tests. Add tests to cover the missing lines. Keep running the tests and improving coverage until all lines are covered.