Opened 5 years ago

Closed 5 years ago

#25899 closed New feature (worksforme)

manage.py tests requires database creation privileges

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

Description

From

#https://docs.djangoproject.com/en/1.9/topics/testing/overview/#the-test-database
By default the test databases get their names by prepending test_ to the value of the NAME settings for the databases defined in DATABASES. 

I guess this works great on sqlite and my homegrown postgres machine, but I'm developing applications on Oracle RAC clusters, and I hope you can see this is not an environment I'd be allowed to create databases on. The database schemas are rather complex (using things like RAW(16) primary keys and reference-based partitioning) and I'm not allowing Django to make the tables itself.

I have been unable to find a workaround in documentation (e.g. --use-this-database-instead-of-creating-one= and --assume-models-are-present ). If this exists, please change this ticket into a documentation request instead.

Change History (8)

comment:1 Changed 5 years ago by JorisBenschop

Component: UncategorizedTesting framework

comment:2 Changed 5 years ago by Tim Graham

A couple sentences after the one you quoted, "If you want to use a different database name, specify NAME in the TEST dictionary for any given database in DATABASES." Could you combine this with the manage.py test --keepdb option to get the desired result?

comment:3 Changed 5 years ago by Shai Berger

There are TEST parameters for this -- Everything from CREATE_DB onwards is essentially serving the need you raise here. Note that settings are much more appropriate than command arguments for this use-case.

Can you offer a documentation change that will make these settings easier to find?

(NAME, specifically, has a very different meaning on Oracle -- it selects the service to connect to, rather than a database on that service like it does for other backends.)

comment:4 Changed 5 years ago by Tim Graham

Doc proposal for the testings docs.

Maybe a subsection under Oracle in docs/ref/databases.txt could also be added if we need more details about those Oracle specific settings?

comment:5 Changed 5 years ago by JorisBenschop

Apologies, I should have read more thoroughly. I will use the pointers given. Thanks for the docs improvement also. I guess this ticket can be resolved-fixed-closed?

comment:6 Changed 5 years ago by Tim Graham <timograham@…>

In 738bda8:

Refs #25899 -- Improved visibility of TEST database settings in testing docs.

comment:7 Changed 5 years ago by Tim Graham <timograham@…>

In 9f3ce6d9:

[1.9.x] Refs #25899 -- Improved visibility of TEST database settings in testing docs.

Backport of 738bda8a6feea95d07b73246365e75b3d25e3466 from master

comment:8 Changed 5 years ago by Tim Graham

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