Xpersona
P

pytest-config

CLAWHUB · Unverified

Provides standardized pytest config, reusable fixtures, and CI integration patterns

62
Rank
84
Safety
1.7k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.7K downloads reported by the source. Last updated 10/10/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17emme0e2m3cpf7k2jvp3a84984b8z9:nm-leyline-pytest-config
  1. Install using `clawhub skill install s17emme0e2m3cpf7k2jvp3a84984b8z9:nm-leyline-pytest-config` in an isolated environment before connecting it to live workloads.
  2. No published capability contract is available yet, so validate auth and request/response behavior manually.
  3. Review the upstream CLAWHUB listing at https://clawhub.ai/athola/nm-leyline-pytest-config before using production credentials.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-leyline-pytest-config/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

145,982 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: pytest-config
description: |
  Provides standardized pytest config, reusable fixtures, and CI integration patterns
version: 1.9.8
triggers:
  - pytest
  - testing
  - configuration
  - fixtures
  - setting up or auditing a Python plugin's test infrastructure
metadata: {"openclaw": {"homepage": "https://github.com/athola/claude-night-market/tree/master/plugins/leyline", "emoji": "\ud83e\udd9e", "requires": {"config": ["night-market.leyline:testing-quality-standards"]}}}
source: claude-night-market
source_plugin: leyline
---

> **Night Market Skill** — ported from [claude-night-market/leyline](https://github.com/athola/claude-night-market/tree/master/plugins/leyline). For the full experience with agents, hooks, and commands, install the Claude Code plugin.


## 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
- 

modules/README.md

# Pytest Configuration Modules

This directory contains modular components of the `leyline:pytest-config` skill, organized following the hub-and-spoke pattern.

## Module Organization

### [conftest-patterns.md](conftest-patterns.md) (159 lines, ~220 tokens)
Conftest.py templates and fixture patterns:
- Project-specific conftest.py template
- Sample data fixtures (skill frontmatter, plugin.json)
- Standard test markers (unit, integration, slow, e2e)
- Domain-specific markers (git, performance, asyncio)
- Test directory structure

**Reusable by**: Any plugin's `tests/conftest.py` setup

### [git-testing-fixtures.md](git-testing-fixtures.md) (87 lines, ~140 tokens)
GitRepository helper class for testing git workflows:
- GitRepository class implementation
- Methods: init, config, add_file, commit
- temp_git_repo fixture
- Usage examples

**Reusable by**: sanctum plugin, git workflow testing, commit/PR testing

### [mock-fixtures.md](mock-fixtures.md) (79 lines, ~95 tokens)
Mock tool fixtures for Claude Code tools:
- mock_bash_tool fixture
- mock_todo_tool fixture
- Usage examples for testing tool interactions

**Reusable by**: Skills testing tool interactions, agent behavior testing

### [ci-integration.md](ci-integration.md) (109 lines, ~120 tokens)
CI/CD integration patterns:
- Common pytest command patterns
- GitHub Actions workflow templates
- Multi-Python version testing
- Makefile integration

**Reusable by**: `.github/workflows/test.yml`, CI/CD pipeline setup

## Usage Pattern

The main SKILL.md (91 lines, ~200 tokens) serves as a hub that:
1. Provides the most frequently reused pyproject.toml configuration
2. Keeps the Quick Start section for immediate use
3. Links to detailed modules for specific patterns
4. Documents integration with other skills

**Total reduction**: From 356 lines (750 tokens) to 91 lines (200 tokens) in main hub - 74% reduction in hub size while preserving all content.

## When to Load Modules

- **conftest-patterns.md** - When setting up test infrastructure or configuring fixtures
- **git-testing-fixtures.md** - When testing git-based workflows (commits, PRs, branches)
- **mock-fixtures.md** - When testing skills that use Claude Code tools
- **ci-integration.md** - When setting up GitHub Actions or CI/CD pipelines

_meta.json

{
  "ownerId": "kn7d107jg9jv602h9ytsegydq184a42s",
  "slug": "nm-leyline-pytest-config",
  "version": "1.9.19",
  "publishedAt": 1787750110987
}

modules/ci-integration.md

---
name: ci-integration
description: GitHub Actions workflows and CI/CD integration patterns for pytest
parent_skill: leyline:pytest-config
category: infrastructure
tags: [pytest, ci-cd, github-actions, automation]
estimated_tokens: 120
reusable_by:
  - ".github/workflows/test.yml"
  - "CI/CD pipeline setup"
  - "automated testing workflows"
---

# CI/CD Integration

GitHub Actions workflows and test commands for automated testing.

## Common Test Commands

```bash
# Run all tests
pytest

# Run with coverage
pytest --cov=src --cov-report=html

# Run specific markers
pytest -m unit
pytest -m "not slow"

# Run failed tests first
pytest --failed-first

# Parallel execution
pytest -n auto

# Verbose output with print statements
pytest -v -s

# Stop on first failure
pytest -x

# Show local variables in tracebacks
pytest -l
```

## GitHub Actions Workflow

```yaml
# .github/workflows/test.yml
name: Tests
on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - run: pip install -e ".[dev]"
      - run: pytest --cov --cov-report=xml
      - uses: codecov/codecov-action@v4
```

## Multi-Python Version Testing

```yaml
# .github/workflows/test.yml
name: Tests
on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ["3.10", "3.11", "3.12"]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}
      - run: pip install -e ".[dev]"
      - run: pytest --cov --cov-report=xml
      - uses: codecov/codecov-action@v4
        if: matrix.python-version == '3.12'
```

## Makefile Integration

```makefile
.PHONY: test
test:
	pytest

.PHONY: test-cov
test-cov:
	pytest --cov=src --cov-report=html --cov-report=term

.PHONY: test-fast
test-fast:
	pytest -m "not slow" -x

.PHONY: test-verbose
test-verbose:
	pytest -v -s
```

modules/conftest-patterns.md

---
name: conftest-patterns
description: Conftest.py templates and fixtures for standardized pytest configuration across plugins
parent_skill: leyline:pytest-config
category: infrastructure
tags: [pytest, fixtures, conftest, testing]
estimated_tokens: 220
reusable_by:
  - "plugins/*/tests/conftest.py"
  - "test infrastructure setup"
---

# Conftest.py Patterns

Reusable conftest.py templates and fixture patterns for Claude Night Market plugin testing.

## Project-Specific conftest.py Template

```python
"""
Test configuration and shared fixtures for {plugin_name} plugin test suite.

This module provides common fixtures, test data, and utilities
for testing {plugin_name} skills, agents, and workflows.
"""

from __future__ import annotations

import json
import tempfile
from pathlib import Path
from typing import Any, Dict, List
from unittest.mock import Mock

import pytest

# Plugin root for test data
PLUGIN_ROOT = Path(__file__).parent.parent


@pytest.fixture
def plugin_root() -> Path:
    """Return the path to the plugin root directory."""
    return PLUGIN_ROOT


@pytest.fixture
def temp_dir(tmp_path: Path) -> Path:
    """Provide a temporary directory for test isolation."""
    return tmp_path


@pytest.fixture(autouse=True)
def isolate_tests(tmp_path: Path, monkeypatch):
    """Isolate tests by changing to temporary directory."""
    monkeypatch.chdir(tmp_path)
    yield


def pytest_configure(config):
    """Configure custom pytest markers."""
    config.addinivalue_line(
        "markers", "unit: Mark test as unit test"
    )
    config.addinivalue_line(
        "markers", "integration: Mark test as integration test"
    )
    config.addinivalue_line(
        "markers", "slow: Mark test as slow running"
    )
```

## Sample Data Fixtures

```python
@pytest.fixture
def sample_skill_frontmatter() -> str:
    """Sample valid skill frontmatter content."""
    return """---
name: example-skill
description: Example skill for testing
category: testing
tags: [test, example]
tools: [Bash, TodoWrite]
complexity: low
estimated_tokens: 300
---

# Example Skill

## When to Use
Use this skill for testing purposes.
"""


@pytest.fixture
def sample_plugin_json() -> dict:
    """Sample valid plugin.json structure."""
    return {
        "name": "test-plugin",
        "version": "1.0.0",
        "description": "Test plugin for testing",
        "skills": ["./skills/example-skill"],
        "keywords": ["test"],
        "license": "MIT",
    }
```

## Standard Test Markers

### Core Markers

```python
# pytest.ini or pyproject.toml
markers = [
    "unit: marks tests as unit tests (deselect with '-m \"not unit\"')",
    "integration: marks tests as integration tests (deselect with '-m \"not integration\"')",
    "slow: marks tests as slow running (deselect with '-m \"not slow\"')",
    "e2e: marks tests as end-to-end tests",
    "smoke: marks tests as smoke tests for quick validation",
]
```

### Domain-Specific Markers

```python
# For testing-focused plugi

Sponsored

Ads related to pytest-config and adjacent AI workflows.