#14296: 'manage.py test' failing for apps that access read-only databases
-----------------------------------+------------------------------------
     Reporter:  kthhrv             |                    Owner:  nobody
         Type:  Bug                |                   Status:  new
    Component:  Testing framework  |                  Version:  1.2
     Severity:  Normal             |               Resolution:
     Keywords:                     |             Triage Stage:  Accepted
    Has patch:  0                  |      Needs documentation:  0
  Needs tests:  0                  |  Patch needs improvement:  0
Easy pickings:  0                  |                    UI/UX:  0
-----------------------------------+------------------------------------
Changes (by Carl Marshall):

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


Comment:

 I'd like to add some more to this again as I'm having this problem with
 Django 2.1.

 I have some large Oracle DBs which are read only, and my app is providing
 an API to. All my models are set to be `managed=False`, and I've set the
 databases to have:

 {{{
         'TEST': {
             'CREATE_DB': False,
             'CREATE_USER': False,
             'USER': env('DATABASE_USER_DEV'),
             'PASSWORD': env('DATABASE_PASSWORD_DEV'),
         }
 }}}

 However, running `python manage.py test` results in
 `django.db.migrations.exceptions.MigrationSchemaMissing: Unable to create
 the django_migrations table (ORA-02000: missing ALWAYS keyword)` which
 suggests to me that we need a "read-only" database option that will stop
 all attempts to generate data on these connections.

 For reference, the app uses a local sqlite or postgress DB for the data it
 can store (and the standard Django apps) as the default database, but
 there is no scope to be able to get write access to these external
 databases, or have them duplicated for testing in any meaningful way (and
 I understand Russell Keith-Mageen concern about live data in tests).

 I'm not sure what the best solution here would be, for example:

 * Using Create DB as False doesn't always mean you can't test the database
 * Tests need to look for any table on the database that is managed, if
 none found, treat as read-only (seems like an expensive option)
 * Have a READ_ONLY test flag that would cause the standard tests to skip
 some of the write based tests

 The main output I want is to be able to run my tests (including the
 standard ones from Django and other packages) without the early
 termination of the test script because of the migrations exception.

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.34ef3669a1b25a737da092b6c746b5d9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to