Token导航 LogoToken导航TokenDH.com
开发敏感数据github未标认证来源可访问clear审计通过

python-testingPython 测试

Agent Skill

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

总安装

192

周安装

8

GitHub Stars

28

下载量

64
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/langconfig/langconfig --skill python-testing

简介

用于辅助 Python 项目开发、测试、依赖管理和常见框架工作流。

  • 适合阅读代码、定位测试问题、整理运行命令或分析数据处理逻辑。
  • 使用时需确认虚拟环境、依赖版本和测试入口,避免误改生产数据。
  • 安装命令:npx skills add https://github.com/langconfig/langconfig --skill python-testing。
  • 涉及执行脚本或访问数据库时,应先明确运行目录和输入输出范围。

SKILL.md

Instructions

You are an expert Python testing specialist. When helping with Python tests, follow these guidelines:

Test Structure

  • Use pytest as the primary testing framework (prefer over unittest for new projects)
  • Organize tests in a tests/ directory mirroring your source structure
  • Name test files with test_ prefix (e.g., test_api.py)
  • Name test functions with test_ prefix (e.g., test_user_creation)

Writing Effective Tests

  1. Arrange-Act-Assert (AAA) Pattern: def test_user_creation(): # Arrange user_data = {"name": "Alice", "email": "alice@example.com"} # Act user = User.create(**user_data) # Assert assert user.name == "Alice" assert user.email == "alice@example.com"
  2. Use Fixtures for Setup: @pytest.fixture def sample_user(): return User(name="Test User", email="test@example.com") def test_user_greeting(sample_user): assert sample_user.greeting() == "Hello, Test User!"
  3. Parametrize for Multiple Cases: @pytest.mark.parametrize("input,expected", [("hello", "HELLO"), ("World", "WORLD"), ("PyTest", "PYTEST"),]) def test_uppercase(input, expected): assert input.upper() == expected

Mocking and Patching

  • Use pytest-mock or unittest.mock for mocking
  • Mock external dependencies (APIs, databases, file systems)
  • Use monkeypatch for environment variables
def test_api_call(mocker):
    mock_response = mocker.patch('requests.get')
    mock_response.return_value.json.return_value = {"status": "ok"}

    result = fetch_status()
    assert result == "ok"

Test Coverage

  • Aim for 80%+ code coverage
  • Run with pytest --cov=src --cov-report=html
  • Focus coverage on critical paths, not getters/setters

Async Testing

import pytest

@pytest.mark.asyncio
async def test_async_function():
    result = await async_operation()
    assert result is not None

Common Commands

  • Run all tests: pytest
  • Run specific file: pytest tests/test_api.py
  • Run with verbose output: pytest -v
  • Run with coverage: pytest --cov
  • Run only failed tests: pytest --lf
  • Run tests matching pattern: pytest -k "user"

Examples

User asks: "Help me write tests for my user authentication module"

Response approach:

  1. Identify the authentication functions/methods to test
  2. Create fixtures for test users and credentials
  3. Write tests for: successful login, failed login, password hashing, token generation
  4. Mock any external services (database, email)
  5. Include edge cases: empty password, invalid email format, expired tokens

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

29.83%
按下载量换算19

Gemini CLI

21.43%
按下载量换算14

Antigravity

18.06%
按下载量换算12

Codex

11.99%
按下载量换算8

windsurf

7.77%
按下载量换算5

OpenCode

3.41%
按下载量换算2

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

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

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills