~/talk

They are not unit tests: a survey of unit-testing anti-patterns

Talkat PyCon Italia 2025 · 2025-05-28..05-31· [testing, developer-experience]
links:none on file
slides:none on file

Defines a unit as the product’s public interface (functions for libs, endpoints for APIs, widgets for GUIs) and shows concrete fixes: replace brittle 300‑line subtests with focused fixtures, prevent tests from importing internals via import-linter, run real DBs with Docker/testcontainers, cache external calls with VCR.py, speed CI by only running affected tests with pytest-testmon (5k tests → 5 run locally), use dirty-equals + inline snapshots to avoid fragile asserts, and run mutation testing to measure assertion quality.

AI-written summary · about

  1. 0:00Introduction and context
  2. 1:06Redefining unit testing
  3. 2:44Public interfaces as units
  4. 5:18Testing pyramids and strategy
  5. 7:24Test desiderata and design
  6. 11:55API testing and linter usage
  7. 14:28Anti-patterns: units and size
  8. 18:46Assertion strategies and demo
  9. 26:38Managing coverage and performance
  10. 29:48Mocking alternatives
  11. 35:30Mutation testing
  12. 37:32Fixture management and cleanup
  13. 40:24Q&A and conclusion
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.