
pytest-gen
โ Officialโ 2,713by github ยท part of github/copilot-cli-for-beginners
Generate comprehensive pytest tests - use when generating tests, creating test suites, or testing Python code
๐ฅ๐ฅ๐ฅโ VerifiedFreeQuick setup
๐งฉ One of 4 skills in the github/copilot-cli-for-beginners package โ works on its own, and pairs well with its siblings.
This is the playbook your agent receives when the skill activates โ you don't need to read it to use the skill, but it's here to audit before installing.
Pytest Generation Skill
When generating tests, follow this structure.
Test Organization
- Group tests by function under test
- Use
@pytest.mark.parametrizefor multiple inputs - Use fixtures for shared setup
- Follow arrange/act/assert pattern
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) == expectedCopy & paste โ that's it
npx skills add github/copilot-cli-for-beginners --skill "pytest-gen" --full-depthRun this in your project โ your agent picks the skill up automatically.
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)
No common issues documented yet. If you hit a problem, the repository's GitHub Issues page is the best place to look.
Licensed under MITโ you can use, modify, and redistribute it under that license's terms.
View the full license file on GitHub โ