21👍
Django’s TestCase
is wrapping every test in its own transaction. So your database is not being used any time you do a request through ORM.
3👍
The database transaction that is being used by django.test.TestCase
can be avoided by inheriting from django.test.TransactionTestCase
instead of TestCase
. Then the data will be visible in the database.
You might want to just do this temporarily while debugging, so that you get the performance benefits of django.test.TestCase
the rest of the time.
Django docs:
django.test.TransactionTestCase
django.test.TestCase
- [Django]-Django Sessions
- [Django]-Django Templates First element of a List
- [Django]-Django.db.utils.OperationalError: fe_sendauth: no password supplied
Source:stackexchange.com