I do quite a bit of work with the Python based Django framework. Django is a flexible framework that leverages the Python programming language. A typical development scenario for development using Django involves writing models and/or views then running unit tests to see if these changes break the application. If you create test data for the unit tests using Django’s fixtures then you might have used Django’s “manage.py dumpdata” to export test and development data to one of your application’s fixtures. If you have used the dumpdata command then you may be experience an error message when running the unit tests that indicates a primary key error when loading “contenttypes”. The unit tests will run, but this warning can be troublesome. There is a simple solution. When using dumpdata specify the “-e contenttypes” switch to exclude the “contenttypes” model. I also suggest specifying “-e contenttypes -e auth”. This should eliminate the primary key error or warning message when you run the unit test.
Refer to this link for more information.