Opened 7 years ago

Closed 7 years ago

#28475 closed New feature (worksforme)

Allow user to skip test database creation per connection

Reported by: Harry Moreno Owned by: nobody
Component: Testing framework Version: dev
Severity: Normal Keywords:
Cc: Adam Johnson Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tim Graham)

I would like to specify in settings.py DATABASES variable that some database connection should be skipped for test database creation.

something like

# settings.py
DATABASES = {
  'secondary': {
    'TEST':  {
      'CREATE': False
    }
  }
}

This is necessary because my project has multiple database connections, some using a Readonly user on the database. When the test management command runs it attempts to create a test database using readonly credentials and the entire test suite fails. A user should be able to specify if a test database should not be created on a database.

Change History (6)

comment:1 by Adam Johnson, 7 years ago

Cc: Adam Johnson added

comment:2 by Adam Johnson, 7 years ago

Component: UncategorizedTesting framework
Type: UncategorizedNew feature
Version: 1.11master

comment:3 by Tim Graham, 7 years ago

Description: modified (diff)

comment:4 by Tim Graham, 7 years ago

I think the easiest solution is to use a separate test settings file that deletes the unneeded entries from DATABASES. Any downside to that?

comment:5 by Harry Moreno, 7 years ago

I think a test_settings.py file would work. I just could not find the relevant docs before. https://docs.djangoproject.com/en/1.11/topics/testing/advanced/#using-the-django-test-runner-to-test-reusable-applications

closing.

comment:6 by Harry Moreno, 7 years ago

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top