This repository has been archived by the owner on Oct 3, 2019. It is now read-only.
Better transaction management in Django TestCase.
Atomiq publish will throw an exception if not used within a transaction, and we want to make sure nobody ships code that is going to throw this exception in production. The problem is that Django TestCase wraps all test functions in a transaction, which masks this error.
This release makes a few changes to the transaction checking:
-
If we are in a TestCase unit test function, we expect to find 3 transactions total: two created by Django and one by the user.
-
If we are in the TestCase setUpClass function, we expect to find 2 transactions: one created by Django and by the user.