[Django] #28475: Allow user to skip test database creation per connection

8 views
Skip to first unread message

Django

unread,
Aug 7, 2017, 12:35:37 PM8/7/17
to django-...@googlegroups.com
#28475: Allow user to skip test database creation per connection
-----------------------------------------+------------------------
Reporter: Harry Moreno | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.11
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
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
}
}
}
}}}

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

Django

unread,
Aug 7, 2017, 12:36:17 PM8/7/17
to django-...@googlegroups.com
#28475: Allow user to skip test database creation per connection
-------------------------------+--------------------------------------

Reporter: Harry Moreno | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.11
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Adam (Chainz) Johnson):

* cc: Adam (Chainz) Johnson (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/28475#comment:1>

Django

unread,
Aug 7, 2017, 12:38:54 PM8/7/17
to django-...@googlegroups.com
#28475: Allow user to skip test database creation per connection
-----------------------------------+--------------------------------------

Reporter: Harry Moreno | Owner: nobody
Type: New feature | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Changes (by Adam (Chainz) Johnson):

* component: Uncategorized => Testing framework
* version: 1.11 => master
* type: Uncategorized => New feature


--
Ticket URL: <https://code.djangoproject.com/ticket/28475#comment:2>

Django

unread,
Aug 7, 2017, 12:42:20 PM8/7/17
to django-...@googlegroups.com
#28475: Allow user to skip test database creation per connection
-------------------------------+--------------------------------------

Reporter: Harry Moreno | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.11
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Harry Moreno):

* component: Testing framework => Uncategorized
* version: master => 1.11
* type: New feature => Uncategorized


Old description:

> 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
> }
> }
> }
> }}}

New description:

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.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/28475#comment:3>

Django

unread,
Aug 7, 2017, 12:52:35 PM8/7/17
to django-...@googlegroups.com
#28475: Allow user to skip test database creation per connection
-----------------------------------+--------------------------------------

Reporter: Harry Moreno | Owner: nobody
Type: New feature | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Description changed by Tim Graham:

Old description:

> 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
> }
> }
> }
> }}}

New description:

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.

--

Django

unread,
Aug 7, 2017, 8:18:49 PM8/7/17
to django-...@googlegroups.com
#28475: Allow user to skip test database creation per connection
-----------------------------------+--------------------------------------

Reporter: Harry Moreno | Owner: nobody
Type: New feature | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
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 Tim Graham):

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

--
Ticket URL: <https://code.djangoproject.com/ticket/28475#comment:4>

Django

unread,
Aug 8, 2017, 10:33:03 AM8/8/17
to django-...@googlegroups.com
#28475: Allow user to skip test database creation per connection
-----------------------------------+--------------------------------------

Reporter: Harry Moreno | Owner: nobody
Type: New feature | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
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 Harry Moreno):

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.

--
Ticket URL: <https://code.djangoproject.com/ticket/28475#comment:5>

Django

unread,
Aug 8, 2017, 10:33:27 AM8/8/17
to django-...@googlegroups.com
#28475: Allow user to skip test database creation per connection
-----------------------------------+--------------------------------------

Reporter: Harry Moreno | Owner: nobody
Type: New feature | Status: closed

Component: Testing framework | Version: master
Severity: Normal | Resolution: worksforme

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by Harry Moreno):

* status: new => closed
* resolution: => worksforme


--
Ticket URL: <https://code.djangoproject.com/ticket/28475#comment:6>

Reply all
Reply to author
Forward
0 new messages