Python
Use: Python impl tasks. Load with hyperwork-tdd skill: skills: [hyperwork-tdd, hyperwork-python].
Toolchain
- Run tests:
uv run pytest(not barepytest). - Lint/format:
uv run pre-commit run --all-filesbefore commit. - Types:
uv run mypy <module>if mypy configured. Required on public API.
Patterns
- Test name:
test_<what>_<condition>. - One assert per concept (multiple asserts OK if same concept).
- Fixtures in
conftest.py— no repeated setup across test files. - Mock at boundary only (external I/O, network, DB). Don't mock internals.
pytest.raisesfor expected exceptions — never baretry/exceptin tests.
Do / Don't
- DON'T: use
unittest.TestCaseunless repo already does — prefer plain functions + pytest. - DON'T: test private methods directly — refactor if tempted.
- DON'T: use bare
pytest— alwaysuv run pytest.