I was following Unit tests part of “Contributing to Django” docs.
Running tests against SQLite with default settings worked fine.
However, when I tried to run the suite against Postgres, it froze repeatedly after running 5906 tests.
I did some digging:
-
some subsets of tests (eg
./runtests.py --settings=postgres_test_settings -v=2 generic_relations
) work fine; -
running
./runtests.py --settings=postgres_test_settings -v=2 auth_tests
freezes, but produces an error on Ctrl+C:
django.db.utils.IntegrityError: insert or update on table "auth_permission" violates foreign key constraint "auth_permission_content_type_id_2f476e4b_fk_django_co"
DETAIL: Key (content_type_id)=(16) is not present in table "django_content_type".
-
running
./runtests.py --settings=postgres_test_settings -v=2 auth_tests.test_migrations
fails 1/10 tests with the same error as above; -
running
./runtests.py --settings=postgres_test_settings -v=2 auth_tests.test_models
freezes, but shows that 49/50 tests passed and shows no errors after Ctrl+C.
I googled an error message, Django ticket #10827 came up. I added INSTALLED_APPS
to my Postgres settings, but that did not help.
Am I missing something in my Postgres settings? Maybe someone can give an example of working Postgres settings?
Any advice on how to debug this further, or should I open a ticket in Django Trac?
Django version:
(4, 1, 0, 'alpha', 0)
Postgres version:
PostgreSQL 12.9 (Ubuntu 12.9-2.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, 64-bit