$npx skillfedfor your agent

Setup Pytest Fixtures

Setup Pytest Fixtures guides you through building reusable test fixtures with factory patterns, async support, and proper conftest organization. Learn to structure fixtures across centralized utilities and layer-specific configurations, then apply them across your test suite.

Setup Pytest Fixtures teaches you to create reusable pytest fixtures with factory patterns and async support.

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

1 0 unlicensed, metadata onlyupdated by dawiddutoit

Decision gist · record as of 2026-01-26

Setup Pytest Fixtures teaches you to create reusable pytest fixtures with factory patterns and async support. Setup Pytest Fixtures guides you through building reusable test fixtures with factory patterns, async support, and proper conftest organization. Learn to structure fixtures across centralized utilities and layer-specific configurations, then apply them across your test suite.

manual: git clone https://github.com/dawiddutoit/custom-claude → cp -r custom-claude ~/.claude/skills/setup-pytest-fixtures

Use it when

  • Setup Pytest Fixtures covers best practices including organizing fixtures in conftest.py for centralized reuse.
  • Setup Pytest Fixtures shows you to use yield in fixture functions to separate setup from teardown code.
Same gist for agents: .md · .json

Install

dawiddutoit/custom-claude/setup-pytest-fixtures · repository language: Python

generated, unverified - the skill's exact subdirectory could not be determined; check the repository on GitHub

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 do I create pytest fixtures?

Setup Pytest Fixtures teaches you to create reusable test fixtures by decorating functions with @pytest.fixture. Define your fixture function in a test file or conftest.py, then pass the fixture name as a parameter to any test that needs it. Fixtures can return data, set up resources, or perform initialization—pytest automatically injects them into your tests.

What are pytest fixture best practices?

Setup Pytest Fixtures covers best practices including organizing fixtures in conftest.py for centralized reuse, using factory patterns for flexible test data, applying proper scopes (function, class, module, session), and implementing teardown logic with yield statements. Structure fixtures across layer-specific configurations and avoid tight coupling between fixtures and tests.

How do I configure pytest fixtures for test initialization and teardown?

Setup Pytest Fixtures shows you to use yield in fixture functions to separate setup from teardown code. Code before yield runs before the test; code after runs after. Alternatively, use request.addfinalizer() for cleanup. Set fixture scope with @pytest.fixture(scope='...') to control when setup and teardown execute across your test suite.

Setting up test fixtures pytest—where do I start?

Setup Pytest Fixtures guides you to begin by creating a conftest.py file in your test directory to centralize fixture definitions. Write fixture functions decorated with @pytest.fixture, then reference them by name in your test functions. Start with function-scoped fixtures for isolated tests, then advance to module or session scopes as your suite grows.

Can Setup Pytest Fixtures help with async test fixtures?

Setup Pytest Fixtures includes async support through pytest-asyncio. Define async fixtures with async def and @pytest.fixture, then use them in async test functions. This enables testing asynchronous code with proper setup and teardown, maintaining the same fixture patterns and scoping rules as synchronous fixtures.

How do I reuse pytest fixtures across multiple test files?

Setup Pytest Fixtures teaches fixture reuse by placing shared fixtures in conftest.py at your project root or test directory. Pytest automatically discovers and makes these fixtures available to all tests in that directory and subdirectories. Use this centralized approach to build a library of common fixtures for database connections, API clients, and test data factories.

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 › “Learn how to create and configure pytest fixtures”

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

Related skills

Test Implement Factory Fixtures
by dawiddutoit · dawiddutoit/custom-claude

Factory fixtures are pytest fixtures that return callable functions, enabling dynamic test setup with customizable parameters. This skill teaches you to eliminate test duplication while maintaining flexibility for edge cases through standard patterns like mock service factories, settings factories, and real instance factories with mock dependencies.

no license declared → metadata onlyupdated Jan 2026
★ 1repo stars
Test Setup Async
by dawiddutoit · dawiddutoit/custom-claude

Test Setup Async provides patterns for testing Python async functions using pytest-asyncio, AsyncMock, and async fixtures. It covers fixture creation with cleanup, mocking async methods with side effects, testing async context managers, and verifying async calls with assertions.

no license declared → metadata onlyupdated Jan 2026
★ 1repo stars
test-harness
by Mathews-Tom · Mathews-Tom/armory

Test Harness builds complete pytest test files from source code, automatically structuring tests across happy paths, edge cases, and error states. It designs fixtures by scope, applies focused mocks to external dependencies, and handles async patterns—all grounded in reconnaissance of your code's complexity and existing test coverage.

MITupdated Jul 2026
★ 274repo stars
Textual Test Fixtures
by dawiddutoit · dawiddutoit/custom-claude

Build reusable test infrastructure for Textual applications with factory patterns, mock strategies, and async fixture designs. Organize conftest.py to eliminate boilerplate across unit, integration, and snapshot tests.

no license declared → metadata onlyupdated Jan 2026
★ 1repo 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
Util Resolve Serviceresult Errors
by dawiddutoit · dawiddutoit/custom-claude

Diagnose and resolve ServiceResult pattern mistakes that cause test failures and type errors. This skill fixes mock configuration problems (like returning dicts instead of ServiceResult objects), async/await pattern issues, and improper unwrap operations in Python service implementations.

no license declared → metadata onlyupdated Jan 2026
★ 1repo stars

More skills python-testing (MIT) · Pytest Configuration (unlicensed) · Pytest Test Data Factories (unlicensed) · pytest-skill (MIT) · Pytest Patterns (unlicensed)

Tags
test-automationfixture-managementpython-testingqa-setuptesting-framework