$npx skillfedfor your agent

python-testing-patterns

Learn to build reliable test suites in Python using pytest, fixtures, and mocking strategies. This skill covers unit and integration testing, test organization, async testing, and coverage measurement. Discover patterns for parametrized tests, external dependency mocking, and test-driven development workflows.

Python Testing Patterns teaches pytest-based unit testing with fixtures, mocking, and parametrization for Python projects.

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

23 13 MITupdated by NickCrew

Decision gist · record as of 2026-06-29

Python Testing Patterns teaches pytest-based unit testing with fixtures, mocking, and parametrization for Python projects. Learn to build reliable test suites in Python using pytest, fixtures, and mocking strategies. This skill covers unit and integration testing, test organization, async testing, and coverage measurement. Discover patterns for parametrized tests, external dependency mocking, and test-driven development workflows.

manual: git clone https://github.com/NickCrew/Claude-Cortex → cp -r Claude-Cortex/skills/python-testing-patterns ~/.claude/skills/python-testing-patterns
skills/python-testing-patterns/SKILL.md · version f1b02200

Use it when

  • python-testing-patterns explains that pytest fixtures are reusable test components that provide data or resources to your tests.
  • python-testing-patterns covers mocking external dependencies and third-party services to isolate your tests from real API calls.

Verify before relying

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

Same gist for agents: .md · .json

Install

NickCrew/Claude-Cortex/python-testing-patterns · repository language: Python

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 unit tests in python with python-testing-patterns?

python-testing-patterns teaches you to build reliable unit tests using pytest, Python's leading testing framework. You'll learn to organize tests into logical suites, use assertions effectively, and structure test files for maintainability. The skill covers writing clear test cases that validate your code's behavior, implementing setup and teardown logic, and following testing best practices to catch bugs early in development.

What are pytest fixtures and how do I set them up?

python-testing-patterns explains that pytest fixtures are reusable test components that provide data or resources to your tests. You'll learn to define fixtures in conftest.py files, scope them appropriately (function, class, module, or session), and use dependency injection to pass them into test functions. Fixtures handle setup and teardown automatically, reducing code duplication and making tests more maintainable and readable.

How can I mock external APIs in pytest?

python-testing-patterns covers mocking external dependencies and third-party services to isolate your tests from real API calls. You'll learn to use unittest.mock and pytest plugins to replace external calls with controlled substitutes, verify that your code calls dependencies correctly, and test error scenarios without hitting live services. This ensures tests run fast, reliably, and independently of external system availability.

What's the best approach to test-driven development in Python?

python-testing-patterns teaches test-driven development by showing how to write tests before implementation code. You'll learn to set up test fixtures, define expected behavior through assertions, then write minimal code to pass tests. This workflow catches design issues early, ensures comprehensive coverage, and creates self-documenting code. The skill demonstrates how TDD improves code quality and reduces debugging time.

How do I measure and improve test coverage in Python projects?

python-testing-patterns covers measuring test coverage to identify untested code paths. You'll learn to use coverage tools, interpret coverage reports, and set meaningful coverage targets. The skill shows how to identify gaps in your test suite, prioritize testing high-risk areas, and incrementally improve coverage. Understanding coverage metrics helps you build more robust applications and catch edge cases.

Can python-testing-patterns help with async code and property-based testing?

Yes, python-testing-patterns covers advanced testing patterns including async code testing with pytest-asyncio and property-based testing using Hypothesis. You'll learn to test asynchronous functions, handle concurrent operations in tests, and use property-based approaches to generate test cases automatically. These techniques catch subtle bugs in complex code that traditional unit tests might miss.

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 property-based testing.

When to Use This Skill

  • Writing unit tests for Python functions and classes
  • Setting up comprehensive test suites and infrastructure
  • Implementing test-driven development (TDD) workflows
  • Creating integration tests for APIs, databases, and services
  • Mocking external dependencies and third-party services
  • Testing async code and concurrent operations
  • Implementing property-based testing with Hypothesis
  • Setting up CI/CD test automation
  • Debugging failing tests and improving test

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

File tree — 13 files
skills/python-testing-patterns/SKILL.md
skills/python-testing-patterns/references/async-testing.md
skills/python-testing-patterns/references/best-practices.md
skills/python-testing-patterns/references/coverage.md
skills/python-testing-patterns/references/fixtures.md
skills/python-testing-patterns/references/integration-testing.md
skills/python-testing-patterns/references/mocking.md
skills/python-testing-patterns/references/monkeypatch.md
skills/python-testing-patterns/references/parametrized-tests.md
skills/python-testing-patterns/references/property-based-testing.md
skills/python-testing-patterns/references/pytest-fundamentals.md
skills/python-testing-patterns/references/test-organization.md
skills/python-testing-patterns/validation/rubric.yaml

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 › “Write and organize unit tests for Python code using pytest”

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 athola · athola/claude-night-market

Python Testing guides you through pytest fundamentals, fixture management, and test-driven development for Python 3.9+ projects. It covers unit and integration testing, async validation, mocking strategies, and coverage configuration to help you build maintainable test suites that meet quality standards.

MITupdated Jul 2026
★ 323repo 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-patterns
by wshobson · wshobson/agents

Learn to build reliable Python tests using pytest, fixtures, mocking, and test-driven development. This skill covers test organization, naming conventions, retry logic, time control with freezegun, markers, and coverage reporting to help you write maintainable test suites.

MITupdated Jul 2026
★ 38,308repo stars
python-testing-patterns
by HermeticOrmus · HermeticOrmus/LibreUIUX-Claude-Code

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.

MITupdated May 2026
★ 86repo 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
pytest
by xobotyi · xobotyi/cc-foundry

Master pytest's core patterns for writing maintainable tests: fixtures for setup and teardown, parametrize for test variations, and monkeypatch for mocking. Learn test structure, granularity, and scope management to build fast, isolated unit tests that serve as executable documentation.

MITupdated Jul 2026
★ 18repo stars

More skills python-testing (MIT) · pytest (MIT) · python-testing (MIT) · python-testing (MIT) · testing-quality-standards (MIT) · testing-perf (MIT) · ruby-patterns (MIT) · socratic-questioning (MIT)

Tags
test-automationquality-assurancecontinuous-integrationcode-validationbehavior-verificationdependency-isolationassertion-frameworktest-infrastructure