Token导航 LogoToken导航

Agent Skill · 研究检索

pytest-configuration(pytest 配置)

用于辅助 Python 项目开发、测试、依赖管理和常见框架工作流。它适合让 Agent 阅读 Python 代码、定位测试问题、整理运行命令、生成脚本或分析数据处理逻辑。使用时需要确认项目虚拟环境、依赖版本和测试入口;涉及执行脚本、读写文件、访问数据库或调用外部 API 时,应先明确运行目录和输入输出范围,避免误改生产数据。

pytest-configuration 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描有未通过项,按安装量在研究检索类的 73,675 个 Skill 里排第 70,834。

总安装 198周安装 8GitHub Stars 1下载 62核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:pytest-configuration(pytest 配置)
来源仓库:https://github.com/dawiddutoit/custom-claude
仓库路径:skills/pytest-configuration
安装命令:
npx skills add https://github.com/dawiddutoit/custom-claude --skill pytest-configuration
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/dawiddutoit/custom-claude --skill pytest-configuration

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于辅助 Python 项目开发、测试、依赖管理和常见框架工作流,适合让 Agent 阅读 Python 代码、定位测试问题、整理运行命令或分析数据处理逻辑。适用于研究检索类任务,支持测试配置管理与信息筛选。通过 npx skills add 命令从指定 GitHub 仓库安装,需确认项目虚拟环境、依赖版本和测试入口。

涉及执行脚本、读写文件或访问数据库时,应先明确运行目录和输入输出范围,避免误改生产数据。可结合原始 README 进一步核验具体用法和功能边界。

来源仓库内路径:skills/pytest-configuration

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/dawiddutoit/custom-claude --skill pytest-confi…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

pytest-configuration 怎么安装?

在终端执行 npx skills add https://github.com/dawiddutoit/custom-claude --skill pytest-configuration。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

pytest-configuration 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

pytest-configuration 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

pytest-configuration 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

pytest-configuration 用的人多吗?

公开数据是累计安装 198 次,近一周安装 8 次,下载 62 次,GitHub 1 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

pytest-configuration 安全吗?

第三方扫描有未通过项,风险较高。除非你确认过源码,否则不建议直接安装到常用环境。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
pytest-configuration

pytest 配置 · 本页

1981接触敏感数据未明确未通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Pytest Configuration

Purpose

Proper pytest configuration ensures fast test discovery, correct isolation, and consistent behavior across environments. This skill provides production-ready configuration patterns.

When to Use This Skill

Use when setting up pytest in a project with "configure pytest", "setup test discovery", "create conftest", or "configure coverage".

Do NOT use for writing tests themselves (use layer-specific testing skills), debugging failures (use test-debug-failures), or mocking strategies (use pytest-mocking-strategy).

Quick Start

Minimal pyproject.toml configuration:

[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]

asyncio_mode = "auto"  # For async tests
asyncio_default_fixture_loop_scope = "function"  # Max isolation

addopts = [
    "--strict-markers",
    "--cov=app",
    "--cov-report=html",
    "--cov-fail-under=80",
]

markers = [
    "unit: Unit tests (fast, mocked)",
    "integration: Integration tests (external services)",
]

Instructions

Step 1: Configure Test Discovery

# pyproject.toml

[tool.pytest.ini_options]
# Where pytest looks for tests
testpaths = ["tests"]

# Test file naming pattern
python_files = ["test_*.py", "*_test.py"]

# Test class naming pattern
python_classes = ["Test*"]

# Test function naming pattern
python_functions = ["test_*"]

# Minimum Python version
minversion = "7.0"

Step 2: Configure Async Support

[tool.pytest.ini_options]
# Auto-detect async tests (no decorator needed)
asyncio_mode = "auto"

# Event loop scope for async tests
# "function": New loop per test (max isolation)
# "module": Shared loop per module (faster)
# "session": Single loop for all tests (fastest)
asyncio_default_fixture_loop_scope = "function"

Step 3: Set Up Custom Markers

[tool.pytest.ini_options]
markers = [
    "unit: Unit tests (fast, fully mocked)",
    "integration: Integration tests (external services)",
    "e2e: End-to-end tests (full pipeline)",
    "slow: Tests that take significant time",
    "smoke: Critical path smoke tests",
    "skip_ci: Skip in CI environment",
]

# Usage:
# pytest -m unit          # Run only unit tests
# pytest -m "not slow"    # Exclude slow tests
# pytest -m "unit or integration"  # Multiple markers

Step 4: Configure Coverage Reporting

[tool.pytest.ini_options]
addopts = [
    "--strict-markers",
    "--strict-config",
    "-ra",                              # All outcomes summary
    "--showlocals",                     # Show local vars in traceback
    "--tb=short",                       # Short traceback format
    "--cov=app",                        # Coverage source
    "--cov-report=html",                # HTML report
    "--cov-report=term-missing",        # Terminal with missing lines
    "--cov-fail-under=80",              # Fail if < 80%
]

# Coverage configuration
[tool.coverage.run]
source = ["app"]
branch = true  # Branch coverage

omit = [
    "*/tests/*",
    "*/__pycache__/*",
    "*/venv/*",
    "*/.venv/*",
]

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

[tool.coverage.html]
directory = "htmlcov"

Step 5: Set Up Logging in Pytest

[tool.pytest.ini_options]
log_cli = true
log_cli_level = "INFO"
log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s"
log_cli_date_format = "%Y-%m-%d %H:%M:%S"

# Or log to file
log_file = "pytest.log"
log_file_level = "DEBUG"
log_file_format = "%(asctime)s [%(levelname)8s] %(name)s: %(message)s"

Step 6: Create Root conftest.py

# tests/conftest.py - Root-level shared fixtures

from __future__ import annotations

import os
from typing import Generator
import pytest

def pytest_configure(config: pytest.Config) -> None:
    """Configure pytest environment before running tests."""
    # Set test environment variables
    os.environ["ENVIRONMENT"] = "test"
    os.environ["LOG_LEVEL"] = "DEBUG"

@pytest.fixture(scope="session", autouse=True)
def test_environment() -> Generator[None, None, None]:
    """Set up test environment for entire session."""
    # Save original environment
    original_env = os.environ.copy()

    # Configure test environment
    os.environ.update({
        "SHOPIFY_SHOP_URL": "https://test.myshopify.com",
        "SHOPIFY_ACCESS_TOKEN": "test_token_123",
        "KAFKA_BOOTSTRAP_SERVERS": "localhost:9092",
        "CLICKHOUSE_HOST": "localhost",
        "CLICKHOUSE_PORT": "8123",
    })

    yield

    # Restore original environment
    os.environ.clear()
    os.environ.update(original_env)

Step 7: Create Unit Test Conftest with Fixtures

# tests/unit/conftest.py - Unit test shared fixtures

from __future__ import annotations

from datetime import datetime
from typing import Optional
import pytest

from app.extraction.domain.entities import Order, LineItem
from app.extraction.domain.value_objects import OrderId, ProductId, ProductTitle, Money

# Test data factories
@pytest.fixture
def create_test_line_item():
    """Factory for LineItem with defaults."""
    def _create(
        product_id: str = "prod_1",
        title: str = "Test Product",
        quantity: int = 1,
        price: float = 99.99,
    ) -> LineItem:
        return LineItem(
            product_id=ProductId(product_id),
            product_title=ProductTitle(title),
            quantity=quantity,
            price=Money.from_float(price),
        )

    return _create

@pytest.fixture
def create_test_order(create_test_line_item):
    """Factory for Order with defaults."""
    def _create(
        order_id: str = "order_123",
        customer_name: str = "Test User",
        items: Optional[list[LineItem]] = None,
    ) -> Order:
        if items is None:
            items = [create_test_line_item()]

        total = sum(
            float(item.price.amount) * item.quantity for item in items
        )

        return Order(
            order_id=OrderId(order_id),
            created_at=datetime.now(),
            customer_name=customer_name,
            line_items=items,
            total_price=Money.from_float(total),
        )

    return _create

Step 8: Create Domain-Specific Conftest Files

# tests/unit/extraction/conftest.py - Extraction context fixtures

from __future__ import annotations

from unittest.mock import AsyncMock, create_autospec
import pytest

from app.extraction.application.ports import ShopifyPort, PublisherPort

@pytest.fixture
def mock_shopify_gateway() -> AsyncMock:
    """Mock Shopify gateway for extraction tests."""
    mock = create_autospec(ShopifyPort, instance=True)

    async def fake_orders():
        yield create_test_order(order_id="1")
        yield create_test_order(order_id="2")

    mock.fetch_orders.return_value = fake_orders()
    return mock

@pytest.fixture
def mock_event_publisher() -> AsyncMock:
    """Mock Kafka publisher for extraction tests."""
    mock = create_autospec(PublisherPort, instance=True)
    mock.publish_order.return_value = None
    mock.close.return_value = None
    return mock

# tests/unit/reporting/conftest.py - Reporting context fixtures

from __future__ import annotations

from unittest.mock import AsyncMock, create_autospec
import pytest

from app.reporting.application.ports import QueryPort
from app.reporting.domain.entities import ProductRanking
from app.reporting.domain.value_objects import Rank

@pytest.fixture
def mock_query_gateway() -> AsyncMock:
    """Mock ClickHouse query gateway for reporting tests."""
    mock = create_autospec(QueryPort, instance=True)
    mock.query_top_products.return_value = [
        ProductRanking(title="Laptop", rank=Rank(1), cnt_bought=100),
        ProductRanking(title="Mouse", rank=Rank(2), cnt_bought=50),
    ]
    return mock

Step 9: Environment-Specific Configuration

# tests/conftest.py - Handle different environments

import os
import pytest

@pytest.fixture(scope="session")
def ci_environment():
    """Detect if running in CI environment."""
    return os.getenv("CI") == "true"

@pytest.fixture(scope="session")
def database_url():
    """Get database URL based on environment."""
    if os.getenv("CI"):
        return "sqlite:///:memory:"  # In-memory for CI
    else:
        return "sqlite:///test.db"  # File-based for local

# Skip tests in CI if marked with skip_ci
def pytest_runtest_setup(item):
    """Skip tests marked with skip_ci when in CI."""
    if item.get_closest_marker("skip_ci"):
        if os.getenv("CI"):
            pytest.skip("Skipping in CI environment")

Step 10: Configure Pytest Plugins

[tool.pytest.ini_options]
# Install plugins: uv add --dev pytest-asyncio pytest-cov pytest-mock pytest-xdist

plugins = [
    "pytest_asyncio",  # Async test support
    "pytest_cov",      # Coverage reporting
]

Examples

Example 1: Complete pyproject.toml

[tool.pytest.ini_options]
# Test discovery
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]

# Async support
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"

# Strict mode
addopts = [
    "--strict-markers",
    "--strict-config",
    "-ra",
    "--showlocals",
    "--tb=short",
    "--cov=app",
    "--cov-report=html",
    "--cov-report=term-missing",
    "--cov-fail-under=80",
]

# Custom markers
markers = [
    "unit: Unit tests",
    "integration: Integration tests",
    "e2e: End-to-end tests",
    "slow: Slow tests",
]

# Logging
log_cli = true
log_cli_level = "INFO"

# Coverage
[tool.coverage.run]
source = ["app"]
branch = true
omit = ["*/tests/*"]

[tool.coverage.report]
precision = 2
show_missing = true

[tool.coverage.html]
directory = "htmlcov"

Example 2: Complete Conftest Hierarchy

tests/
├── conftest.py                    # Root: environment setup
├── unit/
│   ├── conftest.py                # Unit test factories
│   ├── extraction/
│   │   ├── conftest.py            # Extraction mocks
│   │   └── domain/
│   │       └── test_entities.py
│   └── reporting/
│       ├── conftest.py            # Reporting mocks
│       └── domain/
│           └── test_entities.py
└── integration/
    ├── conftest.py                # Container fixtures
    └── test_kafka.py

Example 3: Running Tests by Marker

# Run only unit tests
pytest -m unit

# Run everything except slow tests
pytest -m "not slow"

# Run integration tests
pytest -m integration

# Run unit and integration (skip e2e)
pytest -m "unit or integration"

# Run specific context
pytest tests/unit/extraction/

# Run with parallel execution
pytest -n auto

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

# View coverage report
open htmlcov/index.html

Requirements

  • Python 3.11+
  • pytest >= 7.0
  • pytest-asyncio >= 0.20.0
  • pytest-cov >= 4.0
  • pytest-mock >= 3.10

See Also

平台分布

Codex

35.48%
按下载量换算22

Claude

28.31%
按下载量换算18

Cursor

18.26%
按下载量换算11

Gemini CLI

8.62%
按下载量换算5

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

未通过

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills