This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is pytest-resource-path, a pytest plugin that provides fixtures for uniform access to test resources in isolated directories. It's a Python package distributed on PyPI.
# Run all tests
pytest
# Run specific test
pytest tests/test_specific_module.py
# Run with coverage
python -m pytest --cov=pytest_resource_path --cov-report=htmlThe project uses invokelint for task management. Available commands via invoke:
# Run all linting and style checks
invoke lint.lint
# Run style formatting
invoke style.style
# Clean build artifacts
invoke clean.clean
# Build distribution
invoke dist.distIndividual linting tools configured in pyproject.toml:
ruff- Primary linter with extensive rule setflake8- Additional linting with custom configurationmypy- Type checking with strict modepylint- Additional code quality checksbandit- Security analysis
# Build package
python -m build
# Version management with bump-my-version
bump-my-version bump patch # or minor, majorMain Plugin Module (pytest_resource_path/pytest_resource_path.py):
- Defines pytest fixtures:
resource_pathandresource_path_root - Handles pytest configuration options for customizing directory names
- Factory pattern for creating path resolvers
Path Resolution System:
PathToResourceFactory- Main factory for creating resource pathsAbsolutePathFactory- Handles absolute path resolutionPathFactory- Base path manipulation utilities
Directory Structure Convention:
- Default test directory:
tests/ - Default test resources directory:
testresources/ - Path mapping:
tests/package/module.py→testresources/package/module/test_method/
- Factory Pattern: Used throughout for path creation and resolution
- Plugin Architecture: Integrates with pytest via entry points
- Configuration-driven: Directory names customizable via
pytest.ini
resource_path: Returns absolute Path to test-specific resource directoryresource_path_root: Returns absolute Path to the testresources root directory
Directory names can be customized in pytest.ini:
[pytest]
resource-path.directory-name-tests = integrationtests
resource-path.directory-name-test-resources = data- Line length: 119 characters (Black/Ruff compatible)
- Type hints: Required (mypy strict mode)
- Docstring style: Google convention
- Import style: Force single-line imports (isort)
- Security: Bandit scanning enabled (excludes test assertions)