pytest-testing

Generate pytest tests for Python code with fixtures, mocks, and parameterization.

4|Updated Feb 16, 2017
One-click install
npx skills add https://github.com/nekorush14/dotfiles --skill pytest-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytest-testing
Source: https://github.com/nekorush14/dotfiles/tree/main/configs/claude/skills/pytest-testing
Command: npx skills add https://github.com/nekorush14/dotfiles --skill pytest-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enables writing thorough Python tests with fixtures, mocks, and parameterization to cover unit, integration, and async code.

Core Features & Use Cases

  • Fixtures & Parametrize: Reuse setup and run scenarios across inputs.
  • Mock External Dependencies: Isolate unit tests from external systems.
  • Async Testing: Validate asynchronous code paths.
  • Integration & End-to-End: Compose tests across components/services.

Quick Start

Write tests under tests/, define fixtures in conftest.py, and run pytest with optional coverage.

Frequently Asked Questions about pytest-testing

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

FAQPage Schema
How do I write Python unit tests with pytest that isolate external dependencies?

Unit tests with pytest isolate external dependencies through mocking. Define fixtures in conftest.py for reusable setup, use pytest.mock to replace external calls, and run tests with pytest to verify each unit independently without touching real services or databases.

Can I use pytest fixtures to run the same test across multiple input scenarios?

Yes, pytest parametrize runs the same test function across multiple input sets. Combine parametrize decorators with fixtures defined in conftest.py to reuse setup logic while testing different scenarios, reducing duplicate test code.

How do I test async Python code with pytest?

Pytest supports async testing through pytest-asyncio plugin. Mark async test functions with @pytest.mark.asyncio, define async fixtures for setup, and pytest handles event loop management automatically.

What's the best way to structure integration tests across multiple components?

Compose integration tests by combining fixtures that set up multiple components, use mocks selectively to isolate boundaries between services, and organize tests in conftest.py to share setup logic. Run full pytest suite to validate interactions end-to-end.

Do I need external tools beyond pytest to mock dependencies in tests?

Pytest's built-in mocking capabilities via unittest.mock cover most unit testing needs. For complex scenarios, fixtures in conftest.py provide reusable mock setup, and parametrize handles multi-scenario testing without additional dependencies.