{"enrichment":{"faq":[{"a":"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\u2014pytest automatically injects them into your tests.","q":"How do I create pytest fixtures?"},{"a":"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.","q":"What are pytest fixture best practices?"},{"a":"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.","q":"How do I configure pytest fixtures for test initialization and teardown?"},{"a":"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.","q":"Setting up test fixtures pytest\u2014where do I start?"},{"a":"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.","q":"Can Setup Pytest Fixtures help with async test fixtures?"},{"a":"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.","q":"How do I reuse pytest fixtures across multiple test files?"}],"shadow_tags":["test-automation","fixture-management","python-testing","qa-setup","testing-framework"],"summary_rewrite":"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."},"gist":{"api_url":"https://skillfed.io/api/skills/dawiddutoit/custom-claude/setup-pytest-fixtures.json","as_of":"2026-01-26","description":"Setup Pytest Fixtures teaches you to create reusable pytest fixtures with factory patterns and async support.","install":{"manual":["git clone https://github.com/dawiddutoit/custom-claude","cp -r custom-claude ~/.claude/skills/setup-pytest-fixtures"],"primary":"npx skillfed install dawiddutoit/custom-claude/setup-pytest-fixtures","version":"22c053cc"},"kind":"skill","mirror_url":"https://skillfed.io/dawiddutoit/custom-claude/setup-pytest-fixtures.md","similar":[{"id":"dawiddutoit/custom-claude/test-implement-factory-fixtures","name":"Test Implement Factory Fixtures","publisher":"dawiddutoit/custom-claude","url":"https://skillfed.io/dawiddutoit/custom-claude/test-implement-factory-fixtures"},{"id":"dawiddutoit/custom-claude/textual-test-fixtures","name":"Textual Test Fixtures","publisher":"dawiddutoit/custom-claude","url":"https://skillfed.io/dawiddutoit/custom-claude/textual-test-fixtures"},{"id":"xobotyi/cc-foundry/pytest","name":"pytest","publisher":"xobotyi/cc-foundry","url":"https://skillfed.io/xobotyi/cc-foundry/pytest"},{"id":"JosiahSiegel/claude-plugin-marketplace/python-testing","name":"python-testing","publisher":"JosiahSiegel/claude-plugin-marketplace","url":"https://skillfed.io/JosiahSiegel/claude-plugin-marketplace/python-testing"},{"id":"dawiddutoit/custom-claude/pytest-configuration","name":"Pytest Configuration","publisher":"dawiddutoit/custom-claude","url":"https://skillfed.io/dawiddutoit/custom-claude/pytest-configuration"}],"title":"Setup Pytest Fixtures by dawiddutoit: Learn how to create and configure pytest fixtures \u2014 SkillFed","use":{"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."]},"what":{"lead":"Setup Pytest Fixtures teaches you to create reusable pytest fixtures with factory patterns and async support.","rest":"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."}},"id":"dawiddutoit/custom-claude/setup-pytest-fixtures","install":{"mode":"external","repo":"https://github.com/dawiddutoit/custom-claude"},"links":{"html":"https://skillfed.io/dawiddutoit/custom-claude/setup-pytest-fixtures","md":"https://skillfed.io/dawiddutoit/custom-claude/setup-pytest-fixtures.md","repo":"https://github.com/dawiddutoit/custom-claude"},"meta":{"agents_supported":[],"first_seen":"2026-07-28","forks":0,"language":"Python","last_updated":"2026-01-26","license":null,"name":"Setup Pytest Fixtures","publisher":"dawiddutoit","stars":1},"relations":{"similar":[{"id":"dawiddutoit/custom-claude/test-implement-factory-fixtures"},{"id":"dawiddutoit/custom-claude/textual-test-fixtures"},{"id":"xobotyi/cc-foundry/pytest"},{"id":"Gentleman-Programming/Gentleman-Skills/pytest"},{"id":"prowler-cloud/prowler/pytest"},{"id":"JosiahSiegel/claude-plugin-marketplace/python-testing"},{"id":"dawiddutoit/custom-claude/pytest-configuration"},{"id":"dawiddutoit/custom-claude/pytest-test-data-factories"},{"id":"LambdaTest/agent-skills/pytest-skill"},{"id":"hieutrtr/ai1-skills/pytest-patterns"}]},"slug":{"owner":"dawiddutoit","repo":"custom-claude","skill":"setup-pytest-fixtures"},"version":"22c053cc"}
