Python Testing
affaan-m/ECC
Python testing strategies using pytest, TDD methodology, fixtures, mocking, parametrization, and coverage requirements.
Pytest testing patterns for Python. An agent skill from Gentleman-Programming/Gentleman-Skills.
$ npx skills add Gentleman-Programming/Gentleman-Skills --skill pytest -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install Gentleman-Programming/Gentleman-Skills pytest --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/Gentleman-Programming/Gentleman-Skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/curated/pytest .claude/skills/pytest && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "pytest" agent skill from https://github.com/Gentleman-Programming/Gentleman-Skills/tree/main/curated/pytest into .claude/skills/pytest/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pytest", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/Gentleman-Programming/Gentleman-Skills/tree/main/curated/pytestType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add Gentleman-Programming/Gentleman-Skills --skill pytest -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install Gentleman-Programming/Gentleman-Skills pytest --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/Gentleman-Programming/Gentleman-Skills.git skills-src && mkdir -p .agents/skills && cp -r skills-src/curated/pytest .agents/skills/pytest && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "pytest" agent skill from https://github.com/Gentleman-Programming/Gentleman-Skills/tree/main/curated/pytest into .agents/skills/pytest/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pytest", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add Gentleman-Programming/Gentleman-Skills --skill pytest -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install Gentleman-Programming/Gentleman-Skills pytest --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/Gentleman-Programming/Gentleman-Skills.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/curated/pytest .cursor/skills/pytest && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "pytest" agent skill from https://github.com/Gentleman-Programming/Gentleman-Skills/tree/main/curated/pytest into .cursor/skills/pytest/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pytest", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/Gentleman-Programming/Gentleman-Skills.git --path curated/pytest--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add Gentleman-Programming/Gentleman-Skills --skill pytest -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install Gentleman-Programming/Gentleman-Skills pytest --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/Gentleman-Programming/Gentleman-Skills.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/curated/pytest .gemini/skills/pytest && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "pytest" agent skill from https://github.com/Gentleman-Programming/Gentleman-Skills/tree/main/curated/pytest into .gemini/skills/pytest/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pytest", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install Gentleman-Programming/Gentleman-Skills pytestInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add Gentleman-Programming/Gentleman-Skills --skill pytest -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/Gentleman-Programming/Gentleman-Skills.git skills-src && mkdir -p .github/skills && cp -r skills-src/curated/pytest .github/skills/pytest && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "pytest" agent skill from https://github.com/Gentleman-Programming/Gentleman-Skills/tree/main/curated/pytest into .github/skills/pytest/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pytest", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add Gentleman-Programming/Gentleman-Skills --skill pytest -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install Gentleman-Programming/Gentleman-Skills pytest --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/Gentleman-Programming/Gentleman-Skills.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/curated/pytest .opencode/skills/pytest && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "pytest" agent skill from https://github.com/Gentleman-Programming/Gentleman-Skills/tree/main/curated/pytest into .opencode/skills/pytest/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pytest", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
pytestPytest testing patterns for Python. An agent skill from Gentleman-Programming/Gentleman-Skills.
Pytest is an agent skill from Gentleman-Programming/Gentleman-Skills. Pytest testing patterns for Python. Trigger: When writing Python tests - fixtures, mocking, markers.
Its SKILL.md is about 1.1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Testing & QA, covering Unit testing and Test strategy. It works with pytest and Python. The repository describes itself as: Community-driven AI agent skills for Claude Code, OpenCode, and other AI assistants. Curated patterns and community contributions. The licence is Apache-2.0.
Read from SKILL.md and the folder at commit c8036a3. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
pytestFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Pytest loads about 1.1k tokens when it runs. Until then it costs about 27 tokens; SKILL.md has 19 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from Gentleman-Programming/Gentleman-Skills at commit c8036a3, republished under its Apache-2.0 licence (© Gentleman-Programming). 19 words, ~1,080 tokens.
.claude/skills/pytest/SKILL.md (or your agent's skills folder).import pytest
class TestUserService:
def test_create_user_success(self):
user = create_user(name="John", email="john@test.com")
assert user.name == "John"
assert user.email == "john@test.com"
def test_create_user_invalid_email_fails(self):
with pytest.raises(ValueError, match="Invalid email"):
create_user(name="John", email="invalid")import pytest
@pytest.fixture
def user():
"""Create a test user."""
return User(name="Test User", email="test@example.com")
@pytest.fixture
def authenticated_client(client, user):
"""Client with authenticated user."""
client.force_login(user)
return client
# Fixture with teardown
@pytest.fixture
def temp_file():
path = Path("/tmp/test_file.txt")
path.write_text("test content")
yield path # Test runs here
path.unlink() # Cleanup after test
# Fixture scopes
@pytest.fixture(scope="module") # Once per module
@pytest.fixture(scope="class") # Once per class
@pytest.fixture(scope="session") # Once per test session# tests/conftest.py - Shared fixtures
import pytest
@pytest.fixture
def db_session():
session = create_session()
yield session
session.rollback()
@pytest.fixture
def api_client():
return TestClient(app)from unittest.mock import patch, MagicMock
class TestPaymentService:
def test_process_payment_success(self):
with patch("services.payment.stripe_client") as mock_stripe:
mock_stripe.charge.return_value = {"id": "ch_123", "status": "succeeded"}
result = process_payment(amount=100)
assert result["status"] == "succeeded"
mock_stripe.charge.assert_called_once_with(amount=100)
def test_process_payment_failure(self):
with patch("services.payment.stripe_client") as mock_stripe:
mock_stripe.charge.side_effect = PaymentError("Card declined")
with pytest.raises(PaymentError):
process_payment(amount=100)
# MagicMock for complex objects
def test_with_mock_object():
mock_user = MagicMock()
mock_user.id = "user-123"
mock_user.name = "Test User"
mock_user.is_active = True
result = get_user_info(mock_user)
assert result["name"] == "Test User"@pytest.mark.parametrize("input,expected", [
("hello", "HELLO"),
("world", "WORLD"),
("pytest", "PYTEST"),
])
def test_uppercase(input, expected):
assert input.upper() == expected
@pytest.mark.parametrize("email,is_valid", [
("user@example.com", True),
("invalid-email", False),
("", False),
("user@.com", False),
])
def test_email_validation(email, is_valid):
assert validate_email(email) == is_valid# pytest.ini or pyproject.toml
[tool.pytest.ini_options]
markers = [
"slow: marks tests as slow",
"integration: marks integration tests",
]
# Usage
@pytest.mark.slow
def test_large_data_processing():
...
@pytest.mark.integration
def test_database_connection():
...
@pytest.mark.skip(reason="Not implemented yet")
def test_future_feature():
...
@pytest.mark.skipif(sys.platform == "win32", reason="Unix only")
def test_unix_specific():
...
# Run specific markers
# pytest -m "not slow"
# pytest -m "integration"import pytest
@pytest.mark.asyncio
async def test_async_function():
result = await async_fetch_data()
assert result is not Nonepytest # Run all tests
pytest -v # Verbose output
pytest -x # Stop on first failure
pytest -k "test_user" # Filter by name
pytest -m "not slow" # Filter by marker
pytest --cov=src # With coverage
pytest -n auto # Parallel (pytest-xdist)
pytest --tb=short # Short tracebackpytest, python, testing, fixtures, mocking, parametrize, markers
© Gentleman-Programming, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in curated/pytest of Gentleman-Programming/Gentleman-Skills.
Open the folder on GitHubat commit c8036a3
Pytest next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Pytest this skillGentleman-Programming/Gentleman-Skills | 657 | — | ~1.1k | Automated safety check: Pass | Apache-2.0 | |
| Python Testingaffaan-m/ECC | 275k | 6 repos | ~4.7k | Automated safety check: Pass | MIT | |
| Python Testing Patternsjh941213/my-cc-harness | 126 | 17 repos | ~5.4k | Automated safety check: Pass | None | |
| Python Testingaffaan-m/ECC | 275k | — | ~2.7k | Automated safety check: Pass | MIT | |
| Python Testing Strategiesc0x12c/ai-toolkit | 106 | — | ~747 | Automated safety check: Pass | None | |
| Testing Patternssoftspark/ai-toolkit | 179 | — | ~1.6k | Automated safety check: Pass | Apache-2.0 |
affaan-m/ECC
Python testing strategies using pytest, TDD methodology, fixtures, mocking, parametrization, and coverage requirements.
jh941213/my-cc-harness
Implement comprehensive testing strategies with pytest, fixtures, mocking, and test-driven development.
affaan-m/ECC
Python testing best practices using pytest including fixtures, parametrization, mocking, coverage analysis, async testing, and test organization.
c0x12c/ai-toolkit
Testing patterns for FastAPI with pytest-asyncio, httpx AsyncClient, fixtures, and test data factories.
softspark/ai-toolkit
Testing strategy: pyramid, AAA, mocks/fakes/stubs, flaky tests, coverage.
dzhalaevd/Donatello
Use as the lead skill when choosing what backend tests to write, reviewing test plans, or balancing unit, integration, API, concurrency, and E2E coverage
Gentleman-Programming/Gentleman-Skills
Core catalog of 8 critical Elixir/Phoenix anti-patterns covering error handling, separation of concerns, Ecto queries, and testing.
Gentleman-Programming/Gentleman-Skills
Creates new AI agent skills following the Agent Skills spec.
Gentleman-Programming/Gentleman-Skills
Angular architecture: Scope Rule, project structure, file naming, style guide.
Gentleman-Programming/Gentleman-Skills
Angular core patterns: standalone components, signals, inject, control flow, zoneless.
Gentleman-Programming/Gentleman-Skills
Angular forms: Signal Forms (experimental) and Reactive Forms.
Gentleman-Programming/Gentleman-Skills
Angular performance: NgOptimizedImage, @defer, lazy loading, SSR.
Categories
Pytest testing patterns for Python. An agent skill from Gentleman-Programming/Gentleman-Skills. Pytest is an agent skill from Gentleman-Programming/Gentleman-Skills. Pytest testing patterns for Python.
Pytest fits situations like: tasks that involve Unit testing; tasks that involve Test strategy.
Run `npx skills add Gentleman-Programming/Gentleman-Skills --skill pytest -a claude-code`. Or copy the skill folder (curated/pytest in Gentleman-Programming/Gentleman-Skills) into .claude/skills/pytest in your project. Claude Code loads it when a task matches its description.
Run `npx skills add Gentleman-Programming/Gentleman-Skills --skill pytest -a codex`. Or copy the skill folder (curated/pytest in Gentleman-Programming/Gentleman-Skills) into .agents/skills/pytest in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Gentleman-Programming/Gentleman-Skills --skill pytest -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/pytest, .gemini/skills/pytest, .github/skills/pytest and .opencode/skills/pytest in your project.
Going by SKILL.md and its folder, Pytest needs the command-line tools its instructions call (pytest). Our summary lists: Python 3.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Pytest is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.1k tokens (SKILL.md is roughly 4.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Pytest: Python Testing (affaan-m/ECC, 275k stars), Python Testing Patterns (jh941213/my-cc-harness, 126 stars), Python Testing (affaan-m/ECC, 275k stars) and Python Testing Strategies (c0x12c/ai-toolkit, 106 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
Gentleman-Programming (a GitHub organization) maintains it in Gentleman-Programming/Gentleman-Skills, which has 657 GitHub stars. The repository holds 23 skills in this directory. The repository was last updated on March 28, 2026.
Source: Gentleman-Programming/Gentleman-Skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.