On Monday 21 September 2015 00:46:51 m...@satchamo.com wrote:
> Currently, the TEST database settings like USER and PASSWORD are only used
> by the Oracle backend.
> 
> See:
> https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-TEST_USER
> 
> I just hit a case where it would be nice to use a different database user
> during testing -- and I don't use Oracle. I know there are workarounds, but
> since Django already provides an elegant way to solve the problem (for one
> backend), why not do it for the others?
> 

I would agree, except that the role played by the test user on Oracle is 
different from that which would be played on e.g. PostgreSQL.

Oracle has no concept of separate databases owned by a single user like other 
DBMSs do. Thus, in order to have a throw-away schema for testing, there is no 
choice but to create a user. I suspect on your other backend, the reason to 
use another username for testing is quite different. and the user would not be 
created as part of the test setup.

The Oracle backend allows you to also use a pre-existing user for testing, but 
the purpose there is basically the same as the --keepdb flag (the relevant 
Oracle settings predate --keepdb).

I think there are Oracle-only TEST settings which would make sense for other 
backends -- CREATE_DB and TBLSPACE, mostly. Other than that, I suspect it may 
make sense to use a different host/port for testing -- because for PostgreSQL, 
there are several speed-vs-integrity trade-offs that can only be made at the 
server level. and users' preferences on these trade-offs can differ very 
significantly between a throw-away test database and "production" -- even if 
"production" is really just a developer's database.

> I'd be happy to contribute a patch, but I'm curious if that feature was
> left out of the other backends for a reason.

AFAIK, it was the other way around: The feature was *added* for Oracle, and 
not others, because it was needed there.

HTH,
        Shai.

Reply via email to