﻿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
35923	Test settings for running Django tests with PostgreSQL are not present	Raphael Gaschignard		"If I check out Django and want to run its tests, there's no settings file for running them with PostgreSQL. 

There _is_ one for sqlite (`tests/test_sqlite.py`), which requires no moving parts of course.

There is a settings file that gets copied to `tests/test_postgres.py` by a handful of jobs configured in Github Actions.

{{{
      - name: Create PostgreSQL settings file
        run: mv ./.github/workflows/data/test_postgres.py.tpl ./tests/test_postgres.py
}}}

On top of this, a Jenkins job seems to copy over its own `test_postgres.py` file for its testing purposes (along with many other configuration files).

{{{
+ cp -r /home/jenkins/djangodata/oracle19.env /home/jenkins/djangodata/oragis19.env /home/jenkins/djangodata/runtests_jenkins.sh /home/jenkins/djangodata/test_mysql.py /home/jenkins/djangodata/test_mysql_gis.py /home/jenkins/djangodata/test_oracle19.py /home/jenkins/djangodata/test_oracle19_host.py /home/jenkins/djangodata/test_oragis19.py /home/jenkins/djangodata/test_postgis.py /home/jenkins/djangodata/test_postgres.py /home/jenkins/djangodata/test_spatialite.py /home/jenkins/djangodata/test_sqlite3.py .
}}}

While the Jenkins config is private, this comment on GH (https://github.com/django/django/pull/18827/files#r1849925192) seemed to indicate that the Jenkins settings file is quite similar.

I think we should check in `tests/test_postgres.py` in `tests`. Working on Django locally I feel like I shouldn't need to create an off-tree source file for test settings when there's already one in the tree (just as the template file, hidden away in `.github`).

If there is a concern about the DB name being hardcoded, environment variables feels like the canonical way of doing it.

Not having that file in the source tree means that any issue with PG, if I want to describe the issue I first have to share a config (see #35921).

My maximalist position is I think that since Jenkins is private, then as much of it as possible should be checked into Django proper, so that any sort of CI failure could be investigated with confidence, and rely less on forensics. I have a really hard time imagining what could be in test settings files that couldn't live in `tests` (or `tests/settings/` if one is unhappy with filling up the top level directory with settings files). I haven't thought about this deeply, though."	Cleanup/optimization	closed	Uncategorized	dev	Normal	wontfix		Raphael Gaschignard Mariusz Felisiak	Unreviewed	0	0	0	0	0	0
