Transactions that are ACID, are Isolated. It makes sense to rely on this property for test isolation, if your database supports a full set of queries within the uncommitted transaction like Postgres does. I argue that this is not hacky at all! In fact, the I in ACID guarantees it. How else can you guarantee the integrity of parallel tests?
By default, when you
checkout/1a connection, it’s set tosandbox: true. This means that the adapter starts a database transaction for your test, making all changes to the database tentative and therefore invisible to other connections. When the test is complete, the adapter does not commit the transaction but rolls it back, abandoning all changes made within it and leaving other tests happily unaware.