If I'm using Django I let Django's default test harness handle that for me - it runs each test in a transaction and rolls it back at the end of the test, which is pretty fast.
https://docs.djangoproject.com/en/5.0/topics/testing/overvie...For my other projects I'm generally using SQLite where starting a new in-memory database is so fast it's effectively free.