#24791: Cannot run tests without access to postgres database
---------------------------------------------+------------------------
               Reporter:  blueyed            |          Owner:  nobody
                   Type:  Bug                |         Status:  new
              Component:  Testing framework  |        Version:  1.8
               Severity:  Release blocker    |       Keywords:
           Triage Stage:  Accepted           |      Has patch:  0
    Needs documentation:  0                  |    Needs tests:  0
Patch needs improvement:  0                  |  Easy pickings:  0
                  UI/UX:  0                  |
---------------------------------------------+------------------------
 The change for ticket #16969 prevents Django from being able to run tests
 on Heroku,
 here you are not allowed to connect to the "postgres" database, at least
 with the free tier.

 Would it be an option to use an explicitly configured
 `DATABASES['default']['TEST']['NAME']` setting, instead of 'postgres'
 here?

 Or could there be a new setting, like
 `DATABASES['default']['TEST']['CONNECT_NAME']`?


 The traceback, for reference (Django 1.8.1):

     {{{
     .heroku/python/lib/python2.7/site-
 packages/pytest_django/fixtures.py:53:
     >           db_cfg = setup_databases(verbosity=0, interactive=False)
     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
 _ _ _ _ _
     .heroku/python/lib/python2.7/site-packages/django/test/runner.py:370:
 in setup_databases
         serialize=connection.settings_dict.get("TEST",
 {}).get("SERIALIZE", True),
     .heroku/python/lib/python2.7/site-
 packages/django/db/backends/base/creation.py:354: in create_test_db
         self._create_test_db(verbosity, autoclobber, keepdb)
     .heroku/python/lib/python2.7/site-
 packages/django/db/backends/base/creation.py:447: in _create_test_db
         with self._nodb_connection.cursor() as cursor:
     .heroku/python/lib/python2.7/site-
 packages/django/db/backends/base/base.py:164: in cursor
         cursor = self.make_cursor(self._cursor())
     .heroku/python/lib/python2.7/site-
 packages/django/db/backends/base/base.py:135: in _cursor
         self.ensure_connection()
     .heroku/python/lib/python2.7/site-
 packages/django/db/backends/base/base.py:130: in ensure_connection
         self.connect()
     .heroku/python/lib/python2.7/site-packages/django/db/utils.py:97: in
 __exit__
         six.reraise(dj_exc_type, dj_exc_value, traceback)
     .heroku/python/lib/python2.7/site-
 packages/django/db/backends/base/base.py:130: in ensure_connection
         self.connect()
     .heroku/python/lib/python2.7/site-
 packages/django/db/backends/base/base.py:119: in connect
         self.connection = self.get_new_connection(conn_params)
     .heroku/python/lib/python2.7/site-
 packages/django/db/backends/postgresql_psycopg2/base.py:172: in
 get_new_connection
         connection = Database.connect(**conn_params)
     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
 _ _ _ _ _

         ...

             if dsn is None:
                 if not items:
                     raise TypeError('missing dsn and no parameters')
                 else:
                     dsn = " ".join(["%s=%s" % (k, _param_escape(str(v)))
                         for (k, v) in items])

     >       conn = _connect(dsn, connection_factory=connection_factory,
 async=async)
     E       OperationalError: FATAL:  permission denied for database
 "postgres"
     E       DETAIL:  User does not have CONNECT privilege.

     .heroku/python/lib/python2.7/site-packages/psycopg2/__init__.py:164:
 OperationalError
     }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24791>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.6524272ac63a431db05d274c8c784daa%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to