pytest-skill

Generates production-grade pytest tests in Python with fixtures, parametrize, markers, mocking, and conftest patterns. Use when user mentions "pytest", "conftest", "@pytest.fixture", "@pytest.mark", "Python test". Triggers on: "pytest", "conftest", "Python test", "parametrize", "Python unit test".

By lambdatest · 348 installs

npx skills add lambdatest/agent-skills --skill pytest-skill

Source repository · Upstream listing

Pytest Testing Skill Core Patterns Basic Test Fixtures Parametrize Markers Mocking Assertions Anti Patterns Bad Good Why self.assertEqual() assert x == y pytest rewrites give better output Setup in init @pytest.fixture Lifecycle management Global state Fixture with yield Proper cleanup Huge test functions Small focused tests Easier debugging Quick Reference Task Command Run all pytest Run file pytest tests/test login.py Run specific pytest tests/test login.py::test login success By marker pytest m slow By keyword pytest k "login and not invalid" Verbose pytest v Stop first fail pytest x Last failed pytest lf Coverage pytest cov=myapp cov report=html Parallel pytest n auto (pytest xdist) pyproject.toml Deep Patterns For production grade patterns, see reference/playbook.md : Section What's Inside §1 Config pytest.ini + pyproject.toml with markers, coverage §2 Fixtures Scoping, factories, teardown, autouse, tmp path §3 Parametrize Basic, with IDs, cartesian, indirect §4 Mocking pytest mock, monkeypatch, spies, env vars §5 Async pytest asyncio, async fixtures, async client §6 Exceptions pytest.raises(match=), warnings §7 Markers & Plugins Custom markers, collection hooks §8 Class Based Nested classes, autouse setup §9 CI/CD GitHub Actions matrix, coverage gates §10 Debugging Table 10 common problems with fixes §11 Best Practices 15 item production checklist