MR
Mayur Rathi
@github
⭐ 34.1k GitHub stars

Pytest-Coverage

Pytest-Coverage是一款testing方向的AI技能,核心价值是Run pytest tests with coverage, discover lines missing coverage, and increase coverage to 100%,可用于解决开发者在testing领域的实际问题,帮助用户提升效率、自动化重复任务或优化工作流。

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

Last verified on: 2026-05-30
mkdir -p ./skills/pytest-coverage && curl -sfL https://raw.githubusercontent.com/github/awesome-copilot/main/skills/pytest-coverage/SKILL.md -o ./skills/pytest-coverage/SKILL.md

Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).

Skill Content

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.

🎯 Best For

  • QA engineers
  • Developers writing unit tests
  • Claude users
  • GitHub Copilot users
  • AI users

💡 Use Cases

  • Generating test cases for edge conditions
  • Writing integration test suites
  • Using Pytest-Coverage in daily workflow
  • Automating repetitive testing tasks

📖 How to Use This Skill

  1. 1

    Install the Skill

    Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.

  2. 2

    Load into Your AI Assistant

    Open Claude or GitHub Copilot and reference the skill. Paste the SKILL.md content or use the system prompt tab.

  3. 3

    Apply Pytest-Coverage to Your Work

    Provide context for your task — paste source material, describe your audience, or share existing work to guide the AI.

  4. 4

    Review and Refine

    Edit the AI output for accuracy, tone, and completeness. Add human insight where the AI lacks context.

❓ Frequently Asked Questions

Does this generate test mocks?

Many testing skills include mock generation. Check the install command and skill content for details.

How do I install Pytest-Coverage?

Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/pytest-coverage/SKILL.md, ready to use.

Can I customize this skill for my team?

Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.

⚠️ Common Mistakes to Avoid

Not testing edge cases

AI tends to generate happy-path tests. Manually review for boundary conditions.

Not reading the full skill

Skills contain important context and edge cases beyond the quick start.

🔗 Related Skills