4 ms·
> try to write _all_ your tests without ever having to truncate/delete tables between tests. I've had really good success with running tests like this the way
by geewee 5y ago
> try to write _all_ your tests without ever having to truncate/delete tables between tests.
I've had really good success with running tests like this the way django does it, where you run your entire test within a migration, and then you just rollback the migration at the end of the test.
- piaste 5y agoI assume that means running everything within a transaction? Does that mean you can't use regular transactions in code, since Postgres doesn't support 'true' nested transactions? Or does the Django ORM automatically convert those 'inner' transactions into Postgres SAVEPOINTS?
- geewee 5y agoYes exactly. And yeah Django automatically maps transactions inside transactions to savepoints.