#35322 closed Uncategorized (invalid)
Slow feedback loop in tests using Postgres
Reported by: | Martin Lehoux | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | 5.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I have a growing codebase, and the tests are getting slower and slower. My main concern is when iterating on a small test case, the overhead of running tests is the largest part of the runtime (as opposed to running all tests in continuous integration). I am running tests with pytest-django, my database is a postgres running in a docker-compose.
My baseline was 20sec with --keedp-db. I made some improvements that were easily accessible : --no-migration gave me a 3sec improvement.
But while digging into the code, it seems that whatever options I provide, I cannot skip the call_command("migrate" ...)
part. I wonder why this is the case, because commenting this part gave me a 5.5 sec improvement.
I must say my django startup time has risen up a lot, at around 5 sec.
Is there something I'm missing about running small tests?
Hi there 👋
Please don't raise tickets for asking questions or support requests about using Django. Head over to the forum or Discord where a friendly member of the community will help you: https://www.djangoproject.com/community/