[Django]-Django test.TestCase vs unittest.TestCase

2👍

Django’s django.test.TestCase does not commit the transaction, so it never appears in the database. The whole testcase is executed inside a big transaction, so that you can not check from outside what is happening to the database (since there is actually nothing at all happening to the database until the transaction is committed, which never happens)

1👍

django.test.TestCase do a couple things for you, one of them being creating a test database (and destroying it once the test has completed). This is documented here : https://docs.djangoproject.com/en/stable/topics/testing/overview/#the-test-database

Leave a comment