pytest-code-review

Review pytest test code for async, fixture, parametrization, and mocking best practices.

Updated Feb 17, 2026
One-click install
npx skills add https://github.com/javierhbr/random-poc --skill pytest-code-review-javierhbr
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytest-code-review
Source: https://github.com/javierhbr/random-poc/tree/main/custom-skills/beagle-main/plugins/beagle-python/skills/pytest-code-review
Command: npx skills add https://github.com/javierhbr/random-poc --skill pytest-code-review-javierhbr

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers write more robust and maintainable pytest test suites by identifying common anti-patterns and suggesting best practices.

Core Features & Use Cases

  • Async Testing: Reviews usage of async def, AsyncMock, and await.
  • Fixture Management: Checks for proper fixture scope, cleanup, and usage of conftest.py.
  • Parametrization: Identifies opportunities to use @pytest.mark.parametrize for DRY tests.
  • Mocking Best Practices: Ensures correct patching, verification, and usage of mocks.
  • Use Case: Before merging a new test file, run this Skill to catch potential issues with async handling, inefficient fixtures, or unclear mocking strategies, ensuring tests are reliable and easy to understand.

Quick Start

Use the pytest-code-review skill to analyze the test file '/path/to/your/test_module.py'.

Frequently Asked Questions about pytest-code-review

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

FAQPage Schema
How do I review pytest code for best practices in async testing and fixtures?

To review pytest code for best practices, analyze test files to detect common anti-patterns in async handling, fixture scope, parametrization, and mocking, then apply guidance from reference documentation to improve test reliability and maintainability.

What are common pytest anti-patterns when using AsyncMock and await in test code?

Common pytest anti-patterns in async testing involve incorrect async def usage, improper AsyncMock verification, and missing await calls. Analyzing test files helps detect these issues alongside missing fixture cleanup and duplicated test logic.

How do I check pytest fixtures for proper scope and cleanup in conftest.py?

Checking pytest fixtures requires reviewing test files for proper scope configuration, verifying cleanup routines, and validating conftest.py usage to ensure fixtures properly manage setup and teardown for reliable test isolation.

What is the best way to identify opportunities for pytest parametrize in test files?

The best way to identify parametrization opportunities is to analyze test files for duplicated test logic, then apply @pytest.mark.parametrize to consolidate redundant test cases into DRY, maintainable test structures.

Does this pytest code review approach work without external dependencies?

Yes, this pytest code review approach works without external dependencies. It analyzes test files directly and leverages internal reference documentation to evaluate async patterns, fixtures, parametrization, and mocking practices.