Skip to content
Skillpedia
Testing40k · #7349

pytest-coverage

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.

Skill link

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

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

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.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

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

5 new skills a week. 1 minute to read.

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 '!'.

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
#7349
License
MIT
Updated
10/15/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills