naive test - create objects, get stuff from query, 8 database queries
factoryboy doesn’t make like quicker (but does make code simpler)
factoryboy build() - create but not save - but m2m fields cause trouble - got to 4 queries
prefetch - factory build, give pk, build other, set _result_cache _prefeteched_objects_cache ... Down to 1 second, 0 database queries! but ugly code, and only works with all()
Avoiding the database is faster - much bigger difference than between postgres and sqlite
Carl Meyer - “Mocking the database usually isn’t worth it” (from testing Django talk)
mock redis in python (using dict) -> partly due to nice api, queryset
https://github.com/mjtamlyn/django-test-db
Now we try the naive test again -> 0 database queries, 0.7 seconds
issues
future