Skip to content
Skillpedia
Testing40k · #5292

pytest-coverage

Lets your agent run code tests and check if everything is working well. It helps find and fix parts of the code not being tested.

What it does

This tool helps you check if all your code is being tested. It shows you which parts of your code are not being tested so you can add more tests.

When to use it

  • ✓When you want to ensure all your tests cover the code.
  • ✓When you need to find parts of the code without tests.
  • ✓When the goal is for 100% of your code to be tested.

Example of what to ask your AI

“Check my project's test coverage and show me where tests are missing.”

Want more? Open the sections below.

How to use

The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.

Skill link

https://github.com/github/awesome-copilot/blob/main/skills/pytest-coverage/SKILL.md

Ready-to-paste message

Use this skill to help me: https://github.com/github/awesome-copilot/blob/main/skills/pytest-coverage/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
How it works

The tool runs your tests and checks which lines of code were executed. It creates a report showing the lines that were not tested, marked with a '!'.

Installation

Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.

In the terminal (Claude Code, Codex, Cursor), in your project folder:

npx skills add github/awesome-copilot --skill pytest-coverage

Or download just the file:

curl -L https://raw.githubusercontent.com/github/awesome-copilot/main/skills/pytest-coverage/SKILL.md -o SKILL.md
Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

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.

FAQ

What does 'code coverage' mean?

Code coverage is a metric that indicates which parts of your code were executed by your tests. The goal is to have 100% of the code covered.

What is the 'cov_annotate' directory?

It's a folder where the tool saves files that show line by line which parts of your code were tested and which were not.

How do I know if I need to add more tests?

If a code file in the report has lines marked with '!', it means those lines were not tested and you need to add tests for them.

Details

Original description by the author

Run pytest tests with coverage, discover lines missing coverage, and increase coverage to 100%.

repo: github/awesome-copilot

Popularity

GitHub stars
40k
Ranking position
#5292
License
MIT
Updated
10/15/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills