Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



How does that work when the system under test uses transactions itself?


A lot of databases these days support nested transactions using savepoints, which Django's test framework can take advantage of.

There's a separate mechanism for writing tests where you need to explicitly test transaction mechanics: https://docs.djangoproject.com/en/5.0/topics/testing/tools/#...




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: