Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
eyadsibai avatar

Pytest

  • 61 installs
  • 7 repo stars
  • Updated January 15, 2026
  • eyadsibai/ltk

Helps with testing & qa tasks.

About

pytest is a Claude Code skill for testing & qa. It helps solo builders move faster with AI-assisted development.

  • pytest
  • Testing & QA
  • AI-coding skill

Pytest by the numbers

  • 61 all-time installs (skills.sh)
  • Ranked #1,159 of 2,153 Testing & QA skills by installs in the Skillselion catalog
  • Data as of Jul 30, 2026 (Skillselion catalog sync)
npx skills add https://github.com/eyadsibai/ltk --skill pytest

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs61
repo stars7
Last updatedJanuary 15, 2026
Repositoryeyadsibai/ltk

What it does

Helps with testing & qa tasks.

Files

SKILL.mdMarkdownGitHub ↗

Pytest Testing

Guidance for writing effective tests with pytest.

Core Concepts

Fixtures

Reusable test setup/teardown. Use yield for cleanup.

Scopes:

ScopeRunsUse Case
functionEach testDefault, isolated
classOnce per classShared state in class
moduleOnce per fileExpensive setup
sessionOnce totalDB connections, servers

Key concept: conftest.py makes fixtures available to all tests in directory.

---

Parametrize

Test multiple inputs without repeating code.

Key concept: Generates separate test for each parameter set - failures are isolated.

Use `pytest.param()` for:

  • Custom test IDs
  • Expected failures (marks=pytest.mark.xfail)
  • Conditional skips

---

Markers

Tag tests for filtering and special behavior.

Built-inPurpose
@pytest.mark.skipAlways skip
@pytest.mark.skipif(condition)Conditional skip
@pytest.mark.xfailExpected failure
@pytest.mark.asyncioAsync test (with pytest-asyncio)

Custom markers: Define in pyproject.toml, run with pytest -m "marker"

---

Mocking

ToolUse Case
Mock()Create fake object
patch()Replace import
MagicMock()Mock with magic methods
AsyncMock()Mock async functions

Key concept: Patch where the thing is used, not where it's defined.

---

Test Organization

tests/
├── conftest.py          # Shared fixtures
├── unit/                # Fast, isolated
├── integration/         # Multiple components
└── e2e/                 # Full system

---

Coverage

Key thresholds:

  • 80%+ is good coverage
  • 100% is often overkill
  • Branch coverage catches conditionals

Config in `pyproject.toml`: Set source, branch=true, fail_under

---

Common Commands

CommandPurpose
pytest -vVerbose output
pytest -xStop on first failure
pytest -k "pattern"Filter by name
pytest -m "marker"Filter by marker
pytest -sShow print output
pytest -n autoParallel (pytest-xdist)
pytest --cov=srcWith coverage

---

Best Practices

PracticeWhy
One assertion per testClear failures
Descriptive test namesSelf-documenting
Arrange-Act-AssertConsistent structure
Test behavior, not implementationRefactor-proof
Use factories for test dataMaintainable
Keep tests fastRun often

Resources

  • Pytest docs: <https://docs.pytest.org/>
  • pytest-asyncio: <https://pytest-asyncio.readthedocs.io/>

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.