Opened 7 years ago

Closed 7 years ago

#27571 closed New feature (wontfix)

Conditionally add TEST_DATABASE_PREFIX to db name

Reported by: Alex Alvarez Owned by: nobody
Component: Testing framework Version: dev
Severity: Normal Keywords: TEST_DATABASE_PREFIX
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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

Change History (3)

comment:1 by Tim Graham, 7 years ago

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'] (docs).

comment:2 by Alex Alvarez, 7 years ago

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

comment:3 by Tim Graham, 7 years ago

Resolution: wontfix
Status: newclosed

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

Note: See TracTickets for help on using tickets.
Back to Top