I am using Django 1.7.7 with python 2.7.6 and Postgres as a database, and I am having a problem with TransactionTestCase . In my migrations, I had two data types, and I wanted them to be available during the tests, so I added serialized_rollback = True to my test case ( https://docs.djangoproject.com/en/1.7/topics/testing / overview / # test-case-serialized-rollback ).
The first test case test was fine, but then django complained about IntegrityError :
IntegrityError: duplicate key value violates unique constraint "django_content_type_app_label_6032a1f08b99c274_uniq" DETAIL: Key (app_label, model)=(admin, logentry) already exists.
I managed to run the tests and avoid this error by adding the following parameters to my settings ( https://docs.djangoproject.com/en/1.7/ref/settings/#std:setting-TEST_NON_SERIALIZED_APPS ):
TEST_NON_SERIALIZED_APPS = ['django.contrib.contenttypes', 'django.contrib.auth']
But I would like to know why this is necessary? Is it a rollback error or is it a problem on my side?
source share