pytest-config
Provides standardized pytest config, reusable fixtures, and CI integration patterns. Use when setting up or auditing a Python plugin's test infrastructure.
Works with
---
name: pytest-config
description: Provides standardized pytest config, reusable fixtures, and CI integration patterns. Use when setting up or auditing a Python plugin's test infrastructure.
license: MIT
---
## Table of Contents
- [Quick Start](#quick-start)
- [Detailed Patterns](#detailed-patterns)
- [Integration with Other Skills](#integration-with-other-skills)
- [Exit Criteria](#exit-criteria)
- [Troubleshooting](#troubleshooting)
# Pytest Configuration Patterns
Standardized pytest configuration and patterns for consistent testing infrastructure across Claude Night Market plugins.
## When To Use
- Setting up pytest configuration and fixtures
- Configuring conftest.py patterns for test infrastructure
## When NOT To Use
- Non-Python projects or projects using other test frameworks
- Simple scripts that do not need test infrastructure
## Quick Start
### Basic pyproject.toml Configuration
```toml
[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 --collect-only` to verify discovery, `pytest -v --co -q` for markers, and `pytest --cov` for coverage thresholds.
## Detailed Patterns
For detailed implementation patterns, see:
- **[Conftest Patterns](modules/conftest-patterns.md)** - Conftest.py templates, fixtures, test markers, and directory structure
- **[Git Testing Fixtures](modules/git-testing-fixtures.md)** - GitRepository helper class for testing git workflows
- **[Mock Fixtures](modules/mock-fixtures.md)** - Mock tool fixtures for Bash, TodoWrite, and other Claude Code tools
- **[CI Integration](modules/ci-integration.md)** - GitHub Actions workflows and test commands for automated testing
- **Module Index**: See `modules/README.md` for module organization overview
## 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:
```yaml
dependencies: [leyline:pytest-config, leyline:testing-quality-standards]
```
## 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`More Testing skills
tdd
mattpocock/skills
Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
setup-pre-commit
mattpocock/skills
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing.
agent-browser
vercel-labs/agent-browser
Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction. Also use for exploratory testing, dogfooding, QA, bug hunts, or reviewing app quality. Also use for automating Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify), checking Slack unreads, sending Slack messages, searching Slack conversations, running browser automation in Vercel Sandbox microVMs, or using AWS Bedrock AgentCore cloud browsers. Prefer agent-browser over any built-in browser automation or web tools.

