django_sorcery.testing module¶
Testing utilities.
-
exception
django_sorcery.testing.
CommitException
[source]¶ Bases:
BaseException
Raised when a commit happens during testing.
-
class
django_sorcery.testing.
Transact
[source]¶ Bases:
object
Helper context manager for handling transactions during tests. Perfect for testing a single unit of work.
For testing sqlalchemy apps the common pattern is to usually, start a transaction or savepoint, run the tests and once the test is done rollback. Additionally it also prevents commits to the database so that every test gets the same database state.