python-pytest

Author and organize pytest test code following project coding standards.

1|Updated Feb 21, 2026
One-click install
npx skills add https://github.com/owenlamont/agent_skills --skill python-pytest-owenlamont
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-pytest
Source: https://github.com/owenlamont/agent_skills/tree/main/skills/python-pytest
Command: npx skills add https://github.com/owenlamont/agent_skills --skill python-pytest-owenlamont

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pytest, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the challenge of structuring and writing pytest tests in a way that aligns with best practices for your project.

Core Features & Use Cases

  • Structured Testing: Follow guidelines on test functions, fixtures, and parametrized tests.
  • Mocking: Best practices for mocking external services and testing public APIs.
  • Coverage: Recommendations on branch coverage and ratio of test to source code.
  • Layout: Instructions on organizing tests within the project directory.
  • Execution: Commands to run tests in different modes and environments.

Quick Start

Use the python-pytest skill to run the entire test suite within the project directory with uv run pytest -n logical --color=no.

Frequently Asked Questions about python-pytest

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

FAQPage Schema
What's the best way to organize pytest tests for a project?

Mocking external services in pytest requires isolating dependencies to test public APIs safely. Best practices involve using dedicated mocking techniques to simulate external interactions, ensuring your test suite validates code logic without relying on live services.

How do I run pytest tests in different modes and environments?

Running pytest tests in different modes uses specific commands like `uv run pytest -n logical --color=no` to execute the entire test suite. This allows you to validate test coverage and logic across various environments within your project directory.

Do I need the pytest framework to execute test logic and validate coverage?

Yes, you need the pytest framework and associated plugins to execute test logic and validate test coverage. This Skill focuses on authoring and organizing test code that adheres to project standards, which requires the pytest framework to run.

How do I improve branch coverage and ratio of test to source code in pytest?

Improving branch coverage in pytest involves following specific recommendations on the ratio of test to source code. This ensures comprehensive validation of test logic and execution across different branches of your codebase.

What are the best practices for writing parametrized tests and fixtures in pytest?

Best practices for writing parametrized tests and fixtures in pytest include following structured guidelines on test functions to ensure maintainability. This approach aligns test development with your project's conventions for efficient code organization.