Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Python Testing?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/karthikrshet-python-testing)
---
name: python-testing
description: "Write and fix tests in Python with pytest: use plain assert and fixtures, mocking at boundaries, async tests and CI settings."
tags: [python, testing]
---
# Python Testing
## When to use
- Writing or reviewing Python with pytest tests
- Setting up a test suite
- Fixing slow or flaky tests
## Procedure
1. Use plain assert and fixtures
2. Parametrize cases with pytest.mark.parametrize
3. Use tmp_path and monkeypatch instead of real files/env
4. Mock at boundaries with pytest-mock or respx for HTTP
5. Run with coverage (pytest --cov) and -x for fast feedback
## Checklist
- [ ] Fixtures scoped correctly
- [ ] No network in unit tests
- [ ] Async tests use pytest-asyncio or anyio
## Anti-patterns
- unittest-style classes for everything
- Fixtures with hidden side effects