[Django]-How to test other thread that access database

4👍

Django’s TestCase runs each test class in a single transaction. Any changes are not committed, so other threads cannot read the effects of those changes.

The solution is to use a TransactionTestCase. It will run queries in the default autocommit mode, and your changes will immediately be available to other threads.

👤knbk

Leave a comment