database transaction commit issue within a test (3.1+)

We have some tests that call django.db.connection._commit() in them, and from django3.1 onwards it seems to cause the transaction used in the test to actually be be committed, and the data saved to the test database, rather than rolled back at the end of the test.

In django 3.0 and before this works fine.

We’re doing it to ensure that db operations are saved in different threads (the threading is really just an emulation of running commands from different django instances).

So, any suggestions of alternates to _commit? Or if I knew the ticket/commit/pr that made the change that’d be (probably) helpful too.

(olympia/ at 16492-django32-es-job-fixes · eviljeff/olympia · GitHub leading to CI test fail: