﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
34222	Django unit tests hang when running against a Postgres database	Adrian Garcia	nobody	"I am trying to get the [https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/ Django library tests] running so I can develop a custom backend and everything works fine with the default SQLite settings file, but when I provide one for Postgres random tests will hang with no error. To debug, I am running the test suite with {{{runtests.py --noinput --parallel=1 -v 2 --settings test_postgres}}}

test_postgres.py:
{{{
DATABASES = {
    ""default"": {
        ""ENGINE"": ""django.db.backends.postgresql"",
        ""NAME"": ""postgres"",
        ""USER"": ""user"",
        ""PASSWORD"": ""password"",
        ""HOST"": ""127.0.0.1"",
        ""PORT"": ""5432"",
    },
    ""other"": {
        ""ENGINE"": ""django.db.backends.postgresql"",
        ""NAME"": ""postgres"",
        ""USER"": ""user"",
        ""PASSWORD"": ""password"",
        ""HOST"": ""127.0.0.1"",
        ""PORT"": ""5432"",
    },
}

SECRET_KEY = ""django_tests_secret_key""

# Use a fast hasher to speed up tests.
PASSWORD_HASHERS = [
    ""django.contrib.auth.hashers.MD5PasswordHasher"",
]

DEFAULT_AUTO_FIELD = ""django.db.models.AutoField""

USE_TZ = False

}}}

Am I doing something wrong, or do these test cases hang for others? I cloned the 4.1.x repo and reset it to 2ff479f to specifically test against Django 4.1.4 and it consistently crashes *after* `multiple_database.tests.AuthTestCase` runs. If I get it working, I'll compile a list of test classes I have to skip to get the tests to run through without hanging."	Bug	closed	Testing framework	4.1	Normal	invalid		Egor R	Unreviewed	0	0	0	0	0	0
