fixtures/__init__.py Configuration
The FixturesInitConfigFile manages the
{package_name}/dev/tests/fixtures/__init__.py file.
Overview
Creates a fixtures package that:
- Mirrors the structure of
pyrig.dev.tests.fixtures - Copies only the docstring from the source module
- Ensures the fixtures directory exists with proper package structure
- Provides a place for custom test fixtures
Inheritance
Inherits from: InitConfigFile
What this means:
- Creates
__init__.pyfiles for package initialization - Copies only the docstring from
pyrig.dev.tests.fixtures - Automatically determines target path
- Ensures parent directory is a valid Python package
File Location
Path: {package_name}/dev/tests/fixtures/__init__.py
Source module: pyrig.dev.tests.fixtures
Path transformation: pyrig.dev.tests.fixtures →
{package_name}.dev.tests.fixtures →
{package_name}/dev/tests/fixtures/__init__.py
How It Works
Automatic Generation
When initialized via uv run pyrig mkroot, the file is created with:
- Docstring copy: Only the docstring from
pyrig.dev.tests.fixtures.__init__.pyis copied - Package structure: The
dev/tests/fixtures/directory is created - Package initialization: Parent directories get
__init__.pyfiles
Generated Content
The file contains only the docstring, allowing you to add custom fixture modules.
Usage
Automatic Creation
uv run pyrig mkroot
Purpose
This package is where you can add custom test fixtures for your project. Fixtures defined here are automatically discovered and available to all tests.
See the Fixtures documentation for details on creating custom fixtures.
Best Practices
- Don't modify the docstring: Keep the copied docstring intact
- Add fixture modules: Create fixture files in this directory
- Use pytest decorators: Decorate fixtures with
@pytest.fixtureor pyrig's scope decorators - Follow naming conventions: Use descriptive names for fixture modules