$npx skillfedfor your agent

python-testing-patterns

Learn to structure Python tests using pytest, fixtures, parameterization, and mocking techniques. This skill covers unit and integration testing, test isolation, the AAA pattern, and debugging strategies to establish reliable test infrastructure.

Python Testing Patterns helps you set up comprehensive test suites using pytest fixtures, mocking, and TDD best practices.

AI-generated summary based on this skill's SKILL.md

86 12 MITupdated by HermeticOrmus

Decision gist · record as of 2026-05-27

Python Testing Patterns helps you set up comprehensive test suites using pytest fixtures, mocking, and TDD best practices. Learn to structure Python tests using pytest, fixtures, parameterization, and mocking techniques. This skill covers unit and integration testing, test isolation, the AAA pattern, and debugging strategies to establish reliable test infrastructure.

manual: git clone https://github.com/HermeticOrmus/LibreUIUX-Claude-Code → cp -r LibreUIUX-Claude-Code/plugins/python-development/skills/python-testing-patterns ~/.claude/skills/python-testing-patterns
plugins/python-development/skills/python-testing-patterns/SKILL.md · version 1dd4ab03

Use it when

  • python-testing-patterns covers pytest fixtures as reusable test components that handle setup and teardown automatically.
  • python-testing-patterns demonstrates mocking external dependencies using unittest.mock and pytest plugins.

Verify before relying

Read SKILL.md below before installing (1 file). Open directory: indexed for reading, not audited.

Same gist for agents: .md · .json

Install

HermeticOrmus/LibreUIUX-Claude-Code/python-testing-patterns · repository language: Shell

Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How to write pytest tests in Python?

python-testing-patterns teaches you to write pytest tests by organizing test functions with clear naming conventions (test_* prefix), using the AAA pattern (Arrange, Act, Assert), and structuring assertions with descriptive messages. Start with simple unit tests that verify single behaviors, then progress to fixtures for setup/teardown and parameterization for testing multiple input scenarios efficiently.

What are pytest fixtures and how do setup/teardown work?

python-testing-patterns covers pytest fixtures as reusable test components that handle setup and teardown automatically. Fixtures use the @pytest.fixture decorator and can yield values to tests or clean up resources afterward. The skill explains scope levels (function, class, module, session), dependency injection patterns, and how conftest.py enables sharing fixtures across test files.

How do you mock external dependencies in Python unit tests?

python-testing-patterns demonstrates mocking external dependencies using unittest.mock and pytest plugins. Learn to replace real API calls, database connections, and services with controlled mock objects, verify mock interactions with assert_called_with, and use monkeypatch for environment variables and module attributes. This isolates tests from external systems.

What is test-driven development (TDD) and how to implement it?

python-testing-patterns explains TDD as writing tests before implementation code, following the red-green-refactor cycle. Start by writing a failing test, implement minimal code to pass it, then refactor. This skill shows how TDD improves design, catches bugs early, and creates living documentation through comprehensive test coverage.

How can you test async code and database operations with pytest?

python-testing-patterns covers async testing using pytest-asyncio for coroutines, fixtures with async setup, and testing SQLAlchemy operations with in-memory databases or fixtures. Learn integration testing patterns for database transactions, rollback strategies, and how to test async/await workflows alongside synchronous code.

How do you measure code coverage and improve test quality?

python-testing-patterns teaches coverage measurement using pytest-cov to identify untested code paths, interpret coverage reports, and set quality gates. The skill explains coverage limitations, strategies for meaningful metrics beyond percentages, and how to use parametrized tests and property-based testing with Hypothesis to strengthen test suites.

SKILL.md

Rendered from the published skill. Quoted content, verbatim.

Python Testing Patterns

Comprehensive guide to implementing robust testing strategies in Python using pytest, fixtures, mocking, parameterization, and test-driven development practices.

When to Use This Skill

  • Writing unit tests for Python code
  • Setting up test suites and test infrastructure
  • Implementing test-driven development (TDD)
  • Creating integration tests for APIs and services
  • Mocking external dependencies and services
  • Testing async code and concurrent operations
  • Setting up continuous testing in CI/CD
  • Implementing property-based testing
  • Testing database operations
  • Debugging failing tests

Core Concepts

1. Test Types
  • Unit Tests: Test individual functions/classes in isolation
  • Integration Tests: Test interaction between components
  • Functional Tests: Test complete features end-to-end
  • Performance Tests: Measure speed and resource usage
2. Test Structure (AAA Pattern)

-

(truncated - see the full file via the links below)

File tree — 1 file
plugins/python-development/skills/python-testing-patterns/SKILL.md

Let your AI agent find skills like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.

wish › “Set up comprehensive test suites with pytest fixtures and best practices”

Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →

Related skills

python-testing
by xu-xiang · xu-xiang/everything-claude-code-zh

Learn to build robust Python tests using pytest with test-driven development principles. This skill covers fixtures for setup and teardown, parametrization for running tests across multiple inputs, mocking to isolate dependencies, and achieving meaningful code coverage targets.

MITdocs in Chineseupdated Mar 2026
★ 1,767repo stars
Pytest Patterns
by manutej · manutej/luxor-claude-marketplace

Pytest Patterns teaches you to write reliable Python tests using pytest's core features—fixtures for setup and teardown, parametrization to run tests with multiple inputs, and mocking to isolate dependencies. Learn test organization, coverage analysis, and CI/CD integration to scale from simple unit tests to complex test suites.

no license declared → metadata onlyupdated Jun 2026
★ 61repo stars
Mcp
by martinholovsky · martinholovsky/claude-skills-generator

Master MCP by building secure servers and clients that connect AI assistants to external tools and resources. This skill covers tool registration, transport configuration, authorization patterns, and performance optimization through test-driven development and security-first principles.

Unlicenseupdated Dec 2025
★ 45repo stars
Pytest Testing
by pluginagentmarketplace · pluginagentmarketplace/custom-plugin-python

Master pytest through test-driven development, fixtures, and mocking strategies. Build comprehensive test suites with parametrized tests, external dependency mocking, and CI/CD pipeline integration while measuring code coverage.

no license declared → metadata onlyupdated Jan 2026
★ 5repo stars
python-testing
by affaan-m · affaan-m/ECC

Learn pytest essentials and test-driven development patterns for Python projects. This skill covers fixtures, parametrization, mocking, and coverage strategies to build reliable test suites. Follow the red-green-refactor cycle and achieve 80%+ code coverage on your critical paths.

MITupdated Jul 2026
★ 234,207repo stars
pytest-skill
by LambdaTest · LambdaTest/agent-skills

pytest-skill equips you with patterns for writing robust Python tests using pytest's core features: fixtures for setup and teardown, parametrize for data-driven testing, markers for test organization, and mocking for external dependencies. It covers conftest configuration, exception handling, and best practices for production environments.

MITupdated Jul 2026
★ 339repo stars

More skills python-testing-patterns (MIT) · Test Implement Constructor Validation (unlicensed) · Pytest Coder (NOASSERTION) · python-testing (MIT) · pytest (MIT) · pytest (MIT) · Pytest (unlicensed) · Pytest (unlicensed)

Tags
test-automationquality-assurancecode-coveragedependency-mockingtest-infrastructurebehavior-verificationcontinuous-integrationtest-isolation