pytest-config

athola's avatarfrom athola

Standardized pytest configuration for plugin development with shared test patterns.Triggers: pytest configuration, conftest, fixtures, test setupUse when: setting up pytest for plugin development or creating fixtures

⭐83stars🔀11forks📁View on GitHub🕐Updated Jan 3, 2026

When & Why to Use This Skill

This Claude skill provides a standardized pytest configuration framework specifically designed for plugin development. It streamlines the setup of testing infrastructure by offering pre-configured pyproject.toml patterns, reusable conftest fixtures, and comprehensive coverage reporting. By establishing consistent testing standards, it helps developers ensure high-quality code and robust performance across Python-based projects and Claude agent integrations.

Use Cases

  • 1. Standardizing Test Environments: Quickly establish a consistent pytest configuration across multiple plugin repositories to ensure uniform testing standards and easier maintenance.
  • 2. Automated Quality Enforcement: Implement automated code coverage thresholds and strict marker definitions to maintain high-quality codebases and prevent untested logic from being merged.
  • 3. Advanced Mocking and Fixtures: Utilize specialized fixtures for Git repository simulation and Claude-specific tool mocking to test complex agentic workflows and tool interactions effectively.
  • 4. Seamless CI/CD Integration: Rapidly configure GitHub Actions and automated testing pipelines using standardized patterns for continuous verification of code changes and reliable deployments.
namepytest-config
description|
Triggerspytest configuration, conftest, fixtures, test setup
Use whensetting up pytest for plugin development or creating fixtures
categoryinfrastructure
tags[pytest, testing, configuration, fixtures]
dependencies[leyline:testing-quality-standards]
estimated_tokens200
infrastructure[pytest-config, conftest-patterns, coverage-config]

Pytest Configuration Patterns

Standardized pytest configuration and patterns for consistent testing infrastructure across Claude Night Market plugins.

Quick Start

Basic pyproject.toml Configuration

[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = [
    "-v",
    "--cov=src",
    "--cov-report=term-missing",
    "--cov-fail-under=80",
    "--strict-markers",
]
markers = [
    "unit: marks tests as unit tests",
    "integration: marks tests as integration tests",
    "slow: marks tests as slow running",
]

[tool.coverage.run]
source = ["src"]
omit = ["*/tests/*", "*/migrations/*", "*/__pycache__/*"]
branch = true

[tool.coverage.report]
exclude_lines = [
    "pragma: no cover",
    "def __repr__",
    "def __str__",
    "raise NotImplementedError",
    "if __name__ == .__main__.:",
    "if TYPE_CHECKING:",
    "class .*\\bProtocol\\):",
    "@(abc\\.)?abstractmethod",
]
precision = 2
show_missing = true

Verification: Run pytest -v to verify tests pass.

Detailed Patterns

For detailed implementation patterns, see:

  • Conftest Patterns - Conftest.py templates, fixtures, test markers, and directory structure
  • Git Testing Fixtures - GitRepository helper class for testing git workflows
  • Mock Fixtures - Mock tool fixtures for Bash, TodoWrite, and other Claude Code tools
  • CI Integration - GitHub Actions workflows and test commands for automated testing

Integration with Other Skills

This skill provides foundational patterns referenced by:

  • parseltongue:python-testing - Uses pytest configuration and fixtures
  • pensive:test-review - Uses test quality standards
  • sanctum:test-* - Uses conftest patterns and Git fixtures

Reference in your skill's frontmatter:

dependencies: [leyline:pytest-config, leyline:testing-quality-standards]

Verification: Run pytest -v to verify tests pass.

Exit Criteria

  • pytest configuration standardized across plugins
  • conftest.py provides reusable fixtures
  • test markers defined and documented
  • coverage configuration enforces quality thresholds
  • CI/CD integration configured for automated testing

Troubleshooting

Common Issues

Tests not discovered Ensure test files match pattern test_*.py or *_test.py. Run pytest --collect-only to verify.

Import errors Check that the module being tested is in PYTHONPATH or install with pip install -e .

Async tests failing Install pytest-asyncio and decorate test functions with @pytest.mark.asyncio