Skip to content
cccskills
FreePublished on GitHub

pytest-gen

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

The English summary is being prepared. Showing the original description.

See how to install

Files included (1)

  • SKILL.md1.3 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

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

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

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

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

The English summary is being prepared. Showing the original description.

github/copilot-cli-for-beginners2.9KUpdated Oct 19, 2026

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

The English summary is being prepared. Showing the original description.

github/copilot-cli-for-beginners2.9KUpdated Oct 19, 2026

A minimal skill example - use when learning the skill format

The English summary is being prepared. Showing the original description.

github/copilot-cli-for-beginners2.9KUpdated Oct 19, 2026

See all skills by github

Report a problem with this skill