pytest-coverage

Runs pytest with coverage reports and guides tests toward 100% line coverage.

Updated Aug 28, 2026
One-click install
npx skills add https://github.com/miyake-san/sogo-agent-platform --skill pytest-coverage-miyake-san
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytest-coverage
Source: https://github.com/miyake-san/sogo-agent-platform/tree/main/skills/core/pytest-coverage
Command: npx skills add https://github.com/miyake-san/sogo-agent-platform --skill pytest-coverage-miyake-san

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pytest, pytest-cov.

What problem does it solve? Python test suites often leave code paths untested without developers noticing. This Skill generates pytest coverage reports, identifies exactly which lines lack test coverage, and guides the iterative process of writing tests until every line is covered. ## Core Features & Use Cases - Coverage Report Generation: Runs pytest with the --cov flag and produces annotated source files showing line-by-line coverage status. - Missing Line Detection: Reads annotated files in the cov_annotate directory where lines prefixed with ! mark uncovered code. - Targeted Module Analysis: Supports scoping coverage checks to specific modules or individual test files for focused improvement. - Use Case: Before merging a pull request, run the coverage workflow on your module, find the three uncovered error-handling branches, and add tests until the annotated report shows 100% coverage. ## Quick Start Run pytest coverage on my module, show me which lines are missing tests, and help me write tests until coverage reaches 100%.

Frequently Asked Questions about pytest-coverage

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check test coverage with pytest?

Run pytest with the --cov flag to measure coverage, for example: pytest --cov --cov-report=annotate:cov_annotate. To check a specific module, use pytest --cov=your_module_name --cov-report=annotate:cov_annotate.

How to find which lines are not covered by pytest tests?

Generate an annotated report with --cov-report=annotate:cov_annotate, then open the cov_annotate directory. Each source file has a matching annotated file where lines starting with an exclamation mark are not covered by tests.

Can I run pytest coverage for a single test file?

Yes, specify the test file along with the target module: pytest tests/test_your_module.py --cov=your_module_name --cov-report=annotate:cov_annotate. This scopes both test execution and coverage measurement.

What does the exclamation mark mean in pytest coverage annotate output?

In annotated coverage files, a line starting with ! indicates that line was not executed by any test. Files with 100% coverage have no such markers and do not need review.

What are the limitations of line coverage in pytest?

Line coverage only confirms a line executed, not that all branch conditions or edge cases were tested. Reaching 100% line coverage does not guarantee correct behavior, so combine it with branch coverage and meaningful assertions.