Skip to content
Back to skills

Pytest Code Review

ASecurity

Reviews pytest test code for async patterns, fixtures, parametrize, and mocking. Use when reviewing test_*.py files, checking async test functions, fixture usage, or mock patterns.

  • 79 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added February 8, 2026
developmenttestingcode-review

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned February 12, 2026

npx -y skills add existential-birds/beagle --skill pytest-code-review --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Pytest Code Review?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Pytest Code Review
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/existential-birds-pytest-code-review/badge)](https://www.skillsdirectory.com/skills/existential-birds-pytest-code-review)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: pytest-code-review
description: Reviews pytest test code for async patterns, fixtures, parametrize, and mocking. Use when reviewing test_*.py files, checking async test functions, fixture usage, or mock patterns.
---

# Pytest Code Review

## Quick Reference

| Issue Type | Reference |
|------------|-----------|
| async def test_*, AsyncMock, await patterns | [references/async-testing.md](references/async-testing.md) |
| conftest.py, factory fixtures, scope, cleanup | [references/fixtures.md](references/fixtures.md) |
| @pytest.mark.parametrize, DRY patterns | [references/parametrize.md](references/parametrize.md) |
| AsyncMock tracking, patch patterns, when to mock | [references/mocking.md](references/mocking.md) |

## Review Checklist

- [ ] Test functions are `async def test_*` for async code under test
- [ ] AsyncMock used for async dependencies, not Mock
- [ ] All async mocks and coroutines are awaited
- [ ] Fixtures in conftest.py for shared setup
- [ ] Fixture scope appropriate (function, class, module, session)
- [ ] Yield fixtures have proper cleanup in finally block
- [ ] @pytest.mark.parametrize for similar test cases
- [ ] No duplicated test logic across multiple test functions
- [ ] Mocks track calls properly (assert_called_once_with)
- [ ] patch() targets correct location (where used, not defined)
- [ ] No mocking of internals that should be tested
- [ ] Test isolation (no shared mutable state between tests)

## When to Load References

- Reviewing async test functions → async-testing.md
- Reviewing fixtures or conftest.py → fixtures.md
- Reviewing similar test cases → parametrize.md
- Reviewing mocks and patches → mocking.md

## Review Questions

1. Are all async functions tested with async def test_*?
2. Are fixtures properly scoped with appropriate cleanup?
3. Can similar test cases be parametrized to reduce duplication?
4. Are mocks tracking calls and used at the right locations?

Files in this skill

  • SKILL.md1.9 KB
  • references/async-testing.md5.3 KB
  • references/fixtures.md6.9 KB
  • references/mocking.md10 KB
  • references/parametrize.md9.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.