Pytest Coverage
GitHubOfficialOriginally contributed by @pamelafox as prompts/pytest-coverage.prompt.md; moved into a skill by pull request #761Distributed by GitHub
- Skill
- Review and audit
- Software development
- MIT
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a structured approach to improving software reliability by identifying and covering untested code. By utilizing annotated coverage reports, developers can pinpoint exactly which lines of code are not executed during test runs, allowing for targeted test creation to reach full coverage.
What it does
- Generates annotated coverage reports to visualize test execution paths.
- Identifies specific lines of code that lack test coverage.
- Provides commands to run coverage analysis on entire projects or specific modules.
- Guides the iterative process of adding tests to reach 100% coverage.
When to use it
- When you need to verify the effectiveness of your existing test suite.
- When you are tasked with increasing the test coverage of a legacy codebase.
- When you want to ensure that new features are fully exercised by tests.
- When you need to identify dead or unreachable code paths.
Advantages
- Provides clear visual feedback on untested code via annotated files.
- Supports granular testing by allowing coverage checks on specific modules.
- Promotes a disciplined, iterative approach to improving software quality.
- Helps prevent regressions by ensuring critical logic is covered by tests.
Usage examples
- “Run a coverage report for my entire project and show me the annotated files.”
- The agent executes the pytest coverage command and directs you to the cov_annotate directory to review which lines are missing test coverage.
- “How do I check coverage for only the user_auth module?”
- The agent provides the specific pytest command using the --cov flag targeted at the user_auth module to generate a focused coverage report.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/github/pytest-coverage/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip pytest-coverage.zip -d .agents/skills
Documentation by pamelafox
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.
Files
- ATTRIBUTION.mdAdded by AutoGineer1.1 KiB
- LICENSELicence file added by AutoGineer1.0 KiB
- SKILL.md1.1 KiB
Requirements and compatibility
Written for: GitHub Copilot
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Originally contributed by
@pamelafoxas prompts/pytest-coverage.prompt.mdmoved into a skill by pull request #761
- Publisher
- GitHub (Official)
- Distributed by
- GitHub
- Source
- github/awesome-copilot · skills/pytest-coverage · commit 797337f
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
- Contributors
- pamelafox
AutoGineer is not affiliated with or endorsed by pamelafox or GitHub.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download pytest-coverage.zip