iusztinpaul/squid/squid-testing-python
Claude Code and agent skill by iusztinpaul/squid
- community
Checking that the SKILL.md file is still in the repository.
Write and evaluate effective Python tests using pytest. Use when writing tests, reviewing test code, debugging test failures, or improving test coverage.
Install
npx vskill@latest install iusztinpaul/squid/squid-testing-pythonSKILL.md
Writing Effective Python Tests
Test Structure
Mirror the module layout
Keep a one-to-one relationship between test files and the modules they cover: myapp/service.py → tests/.../test_service.py. This makes the test for any given module obvious and keeps coverage gaps visible.
Follow AAA (Arrange, Act, Assert)
Structure each test body in three beats — set up inputs (Arrange), call the thing under test (Act), then assert on the result. Keep them in that order; don't interleave more setup after the act.
Atomic unit tests
Each test should verify a single behavior. The test name should tell you what's broken when it fails. Multiple assertions are fine when they all verify the same behavior.
Use parameterization for variations of the same concept
Don't parameterize unrelated behaviors — if the test logic differs, write separate tests.
Project-Specific Rules
Imports at module level
Put ALL imports at the top of the file. Do not import inside test function bodies.
Async tests
If the project sets asyncio_mode = "auto" in pyproject.toml, write async tests without decorators:
Otherwise, mark explicitly with @pytest.mark.asyncio.
Inline snapshots for complex data
If the project uses inline-snapshot, use it for JSON schemas and complex structures:
Commands:
pytest --inline-snapshot=create- populate empty snapshotspytest --inline-snapshot=fix- update after intentional changes
Fixtures
Share setup through fixtures, not setup/teardown methods
Put shared fixtures in conftest.py so they're available across test files without imports. Use fixtures (and their yield-based teardown) for setup and cleanup — avoid xUnit-style setUp/tearDown methods.
Prefer function-scoped fixtures
Use tmp_path for file operations
Mocking
Mock at the boundary
Use pytest-mock's mocker fixture (preferred) or unittest.mock patches.
Don't mock what you own
Test your code with real implementations when possible. Mock external services (HTTP APIs, third-party SDKs), not your own internal classes.
Don't write unit tests against infrastructure components
Orchestrators, model-serving runtimes, observability clients, and similar infrastructure should be exercised via integration tests, not unit tests with mocks of their internals.
Test Naming
Test files must be named test_*.py and test functions test_* so pytest discovers them. Beyond that, use descriptive names that explain the scenario:
Running Tests
Prefer project Make targets when available: make unit-tests, make integration-tests, make tests. Otherwise uv run pytest -n auto (parallel). The suite must finish with 0 warnings.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/squid-testing-python/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/iusztinpaul/squid/squid-testing-python)