# pytest

Teaches the agent to write tests for support APIs, databases, and background jobs using FastAPI and SQLAlchemy. Sets up pytest fixtures and async tests.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 455 installs · ★ 62
- Author: Claude Support Team
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/manutej/luxor-claude-marketplace/tree/HEAD/plugins/luxor-testing-essentials/skills/pytest/SKILL.md
- Updated: 2026-06-13
- HTML: https://affpapa.org/en/nevibecode/skills/claude-support-team-pytest

## What it does

This skill guides the coding agent through writing backend tests for customer support infrastructure. It focuses on FastAPI endpoints, database transactions in PostgreSQL, and ticket processing workflows.

Inside are patterns for fixture scoping. The database engine initializes once per session, while individual test functions receive isolated sessions with automatic rollbacks. It also provides patterns for mocking third-party email providers and CRM webhooks.

The test suite relies on `pytest>=8.0.0`, `pytest-asyncio>=0.23.0`, and `sqlalchemy>=2.0.0`. Running these suites without the matching pytest plugins will break test discovery immediately.

## Requirements
- Works with: PostgreSQL

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add manutej/luxor-claude-marketplace --skill pytest -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/pytest/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/pytest/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add manutej/luxor-claude-marketplace --skill pytest -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/pytest/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add manutej/luxor-claude-marketplace --skill pytest -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/pytest/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install manutej/luxor-claude-marketplace pytest
```

2. **Manually: put the files in place**
- File: `.github/skills/pytest/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add manutej/luxor-claude-marketplace --skill pytest -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/manutej/luxor-claude-marketplace --path plugins/luxor-testing-essentials/skills/pytest
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/pytest/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add manutej/luxor-claude-marketplace --skill pytest -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/manutej/luxor-claude-marketplace/tree/HEAD/plugins/luxor-testing-essentials/skills/pytest/SKILL.md

## When to use it
- Create database fixtures with automatic transaction rollbacks in PostgreSQL
- Test asynchronous task queues and webhook deliveries
- Write test suites for FastAPI ticket endpoints
- Mock third-party services for email and CRM integrations

## Example prompts
- Write a pytest database session fixture in SQLAlchemy with automatic rollback for each test
- Create a test for an async FastAPI ticket creation route with Pydantic payload validation
- Mock the external email provider using pytest-mock to test SLA escalation logic

## Similar
- [improve-codebase-architecture](https://affpapa.org/en/nevibecode/skills/improve-codebase-architecture.md) — skill · 1163035 installs
- [design-taste-frontend](https://affpapa.org/en/nevibecode/skills/design-taste-frontend.md) — skill · 678700 installs
- [tdd](https://affpapa.org/en/nevibecode/skills/tdd.md) — skill · 1141062 installs
- [skill-creator](https://affpapa.org/en/nevibecode/skills/skill-creator.md) — skill · 414180 installs
- [agent-browser](https://affpapa.org/en/nevibecode/skills/vercel-labs-agent-browser.md) — skill · 1200000 installs
- [prototype](https://affpapa.org/en/nevibecode/skills/prototype.md) — skill · 986201 installs

From the same set: [manutej/luxor-claude-marketplace](https://affpapa.org/en/nevibecode/by/manutej/luxor-claude-marketplace.md) — 65 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
