How do you approach code quality and testing in Python projects?
Give a layered answer, and avoid quoting a coverage percentage as if it were the goal.
Automated tooling first, because conventions that are not enforced decay:
- Formatting — black or ruff format, so style is never a review topic.
- Linting — ruff or flake8 for the errors a human reader misses.
- Type checking — mypy or pyright. Type hints on function boundaries catch a genuine class of bug and double as documentation.
- All of it in CI, so it cannot be skipped.
Testing, in order of value per line:
- Unit tests on business logic — fast, no I/O, and where most real bugs live.
- Integration tests on the seams — the database layer, the external API client.
- A few end-to-end tests on the flows that must never break.
Note: Mention pytest fixtures for setup, parametrize for table-driven cases, and mocking only at the boundary. Over-mocking produces tests that pass while the code is broken, which is worse than having no tests.





