[Django] #27571: Conditionally add TEST_DATABASE_PREFIX to db name

31 views
Skip to first unread message

Django

unread,
Dec 4, 2016, 11:12:26 AM12/4/16
to django-...@googlegroups.com
#27571: Conditionally add TEST_DATABASE_PREFIX to db name
-------------------------------------+-------------------------------------
Reporter: Alex | Owner: nobody
Alvarez |
Type: New | Status: new
feature |
Component: Testing | Version: master
framework | Keywords:
Severity: Normal | TEST_DATABASE_PREFIX
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I setup a test runner for postgres, pointing to a local postgres that's
setup on the fly, but the test database name was being rewritten -- which
was done for safety reasons, I get it -- it's documented.

It would be nice if the database already had `TEST_DATABASE_PREFIX` , we
wouldn't add it again.
e.g. -- not do `test_<db_name>` to `test_test_<db_name>`

https://github.com/django/django/pull/7655

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

Django

unread,
Dec 5, 2016, 8:50:28 AM12/5/16
to django-...@googlegroups.com
#27571: Conditionally add TEST_DATABASE_PREFIX to db name
-------------------------------------+-------------------------------------
Reporter: Alex Alvarez | Owner: nobody
Type: New feature | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
TEST_DATABASE_PREFIX | Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham):

Isn't this backwards-incompatible? Any project that prefixes its database
with `test_` will now have it clobbered by the test database. If you want
a specific test database name, then you should use
`DATABASES['TEST']['NAME']`
([https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-
TEST_NAME docs]).

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

Django

unread,
Dec 6, 2016, 9:31:41 PM12/6/16
to django-...@googlegroups.com
#27571: Conditionally add TEST_DATABASE_PREFIX to db name
-------------------------------------+-------------------------------------
Reporter: Alex Alvarez | Owner: nobody
Type: New feature | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
TEST_DATABASE_PREFIX | Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Alex Alvarez):

Isn't this backwards-incompatible? yeah it is.

As I mentioned the behavior is documented, I was just curious if anyone
else thought like me and found it annoying that said database name changes
even when you follow the naming convention.

For me, I'm operating in mixed environment where not all db connections
are instantiated from django and it caused a lot of headache before
realizing the db name was being renamed just because I changed from sql-
lite to postgres

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

Django

unread,
Dec 6, 2016, 10:23:36 PM12/6/16
to django-...@googlegroups.com
#27571: Conditionally add TEST_DATABASE_PREFIX to db name
-------------------------------------+-------------------------------------
Reporter: Alex Alvarez | Owner: nobody
Type: New feature | Status: closed

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

Keywords: | Triage Stage:
TEST_DATABASE_PREFIX | Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

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


Comment:

I don't see a strong rationale for changing the behavior.

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

Reply all
Reply to author
Forward
0 new messages