pytest-gen

Generate comprehensive pytest tests - use when generating tests, creating test suites, or testing Python code

2,060 stars

Best use case

pytest-gen is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Generate comprehensive pytest tests - use when generating tests, creating test suites, or testing Python code

Teams using pytest-gen should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/pytest-gen/SKILL.md --create-dirs "https://raw.githubusercontent.com/github/copilot-cli-for-beginners/main/.github/skills/pytest-gen/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/pytest-gen/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How pytest-gen Compares

Feature / Agentpytest-genStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Generate comprehensive pytest tests - use when generating tests, creating test suites, or testing Python code

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Pytest Generation Skill

When generating tests, follow this structure.

## Test Organization

- Group tests by function under test
- Use `@pytest.mark.parametrize` for multiple inputs
- Use fixtures for shared setup
- Follow arrange/act/assert pattern

## Coverage Requirements

- Happy path (expected usage)
- Edge cases (empty strings, None, boundary values)
- Error cases (invalid input, file not found, wrong types)
- Integration (functions working together)

## Template

```python
import pytest
from module_under_test import function_to_test


@pytest.fixture
def sample_data():
    """Provide shared test data."""
    return {"key": "value"}


class TestFunctionName:
    """Tests for function_name."""

    def test_happy_path(self, sample_data):
        result = function_to_test(valid_input)
        assert result == expected_output

    def test_empty_input(self):
        result = function_to_test("")
        assert result == expected_for_empty

    @pytest.mark.parametrize("input_val,expected", [
        ("valid", True),
        ("", False),
        (None, False),
    ])
    def test_various_inputs(self, input_val, expected):
        assert function_to_test(input_val) == expected
```

Related Skills

hello-world

2060
from github/copilot-cli-for-beginners

A minimal skill example - use when learning the skill format

commit-message

2060
from github/copilot-cli-for-beginners

Generate conventional commit messages - use when creating commits, writing commit messages, or asking for git commit help

code-checklist

2060
from github/copilot-cli-for-beginners

Team code quality checklist - use for checking Python code quality, bugs, security issues, and best practices

pytest-coverage

28865
from github/awesome-copilot

Run pytest tests with coverage, discover lines missing coverage, and increase coverage to 100%.

pytest-code-review

3891
from openclaw/skills

Reviews pytest test code for async patterns, fixtures, parametrize, and mocking. Use when reviewing test_*.py files, checking async test functions, fixture usage, or mock patterns.

pytest-test-generator

1868
from jeremylongshore/claude-code-plugins-plus-skills

Pytest Test Generator - Auto-activating skill for Test Automation. Triggers on: pytest test generator, pytest test generator Part of the Test Automation skill category.

pytest Testing

509
from a5c-ai/babysitter

Expert pytest framework for Python unit, integration, and functional testing

pytest-ml-tester

509
from a5c-ai/babysitter

ML-specific testing skill using pytest with fixtures for data, models, and predictions.

compose-multiplatform-patterns

144923
from affaan-m/everything-claude-code

KMP项目中的Compose Multiplatform和Jetpack Compose模式——状态管理、导航、主题化、性能优化和平台特定UI。

java-coding-standards

144923
from affaan-m/everything-claude-code

Spring Bootサービス向けのJavaコーディング標準:命名、不変性、Optional使用、ストリーム、例外、ジェネリクス、プロジェクトレイアウト。

continuous-learning

144923
from affaan-m/everything-claude-code

Claude Codeセッションから再利用可能なパターンを自動的に抽出し、将来の使用のために学習済みスキルとして保存します。

nextjs-best-practices

31392
from sickn33/antigravity-awesome-skills

Next.js App Router principles. Server Components, data fetching, routing patterns.