#33685: Using new postgresql settings fails when running tests
-----------------------------------+--------------------------------------
     Reporter:  Shane Ambler       |                    Owner:  nobody
         Type:  Bug                |                   Status:  closed
    Component:  Testing framework  |                  Version:  4.0
     Severity:  Normal             |               Resolution:  invalid
     Keywords:                     |             Triage Stage:  Unreviewed
    Has patch:  0                  |      Needs documentation:  0
  Needs tests:  0                  |  Patch needs improvement:  0
Easy pickings:  0                  |                    UI/UX:  0
-----------------------------------+--------------------------------------

Comment (by Shane Ambler):

 Replying to [comment:5 Mariusz Felisiak]:
 > If you want to user PostgreSQL's password files, all required databases
 must be included, i.e. `postgres`, `dbname`, `test_dbname`, e.g. the
 following configuration works for me
 > {{{
 > localhost:5432:postgres:postgres_username:SeCrEtPassworD
 > localhost:5432:dbname:postgres_username:SeCrEtPassworD
 > localhost:5432:test_dbname:postgres_username:SeCrEtPassworD
 > }}}

 Yes, I tried both the `test_dbname` and `*` to match any dbname and it
 still fails.

 > `settings.py`:
 > {{{#!python
 > DATABASES = {
 >     'default': {
 >         'ENGINE': 'django.db.backends.postgresql',
 >         'HOST': 'localhost',
 >         'PORT': 5432,
 >         'NAME': 'dbname',
 >         'USER': 'postgres_username',
 >         'OPTIONS': {
 >             'passfile': '.custompgpass',
 >         }
 >     },
 > }
 > }}}

 While you are maintaining both old and new config variations, all will
 continue to work for you.

 If you remove the old, no longer documented, settings of `HOST` `PORT`
 `NAME` `USER` then your setup will work for `runserver` but not `test`

 The pg docs [https://docs.djangoproject.com/en/4.0/ref/databases
 /#postgresql-notes-1] only documents the new method of specifying
 `service` and `passfile` in the `OPTIONS` - this documented setup **does
 not support running tests** with postgresql databases.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33685#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070180abc98134-f175cefc-ca78-4bb3-8d1a-0d5b18c3198d-000000%40eu-central-1.amazonses.com.

Reply via email to