#17762: Multi-db apps (no Django test suite) testing fails to create in-memory
sqlite DBs
-------------------------------------+-------------------------------------
     Reporter:  agriffis             |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  1.3
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:                       |      Needs documentation:  0
    Has patch:  1                    |  Patch needs improvement:  1
  Needs tests:  1                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by ramiro):

 Sorry, I can't reproduce this, my previous attempt failed because it
 wasn't correctly set up.

 This is how I tested:

 1. Created a project.
 2. Added an application by simply the
 `tests/regressiontests/multiple_database` Django trunk regression test
 (here I'm trusting it to assure us multi-DB functionality is effectively
 working) to a `mdb` application directory and adding it to the
 INSTALLED_APPS setting.

    This means some 'multiple_database' -> 'mdb' replacements must be made
 in the app files:
 {{{
 $ cd mdb
 $ ack -l multiple_database --type-set json=.json --py --json |xargs sed -i
 s/multiple_database/mdb/g
 }}}
 3. Edited the DATABASES setting to look like this:
 {{{
 DATABASES = {
     'default': {
         'ENGINE': 'django.db.backends.sqlite3',
         'NAME': 'data.db',
     },
     'other': {
         'ENGINE': 'django.db.backends.sqlite3',
         #'TEST_NAME': ':memory:',
     }
 }
 }}}

 4. Now I can run the tests for the 'mdb' app and they run without
 failures:
 {{{
 /manage.py test -v2 mdb
 Creating test database for alias 'default' (':memory:')...
 [...]
 Creating test database for alias 'other' (':memory:')...
 [...many lines of tests output...]
 ----------------------------------------------------------------------
 Ran 51 tests in 1.099s

 OK
 Destroying test database for alias 'default' (':memory:')...
 Destroying test database for alias 'other' (':memory:')...
 }}}
    Note how with verbosity=2 the test runner reports the names of the test
 DBs it is creating/destroying.

 5. I tested this with: 1.3, 1.3.1, current 1.3.X branch tip and trunk,
 always with the same results.

 Could you give us more details how are you getting the ''"Django fails to
 create multiple in-memory SQLite databases, instead it creates only one
 (which is populated only with the table definitions for the default DB)"''
 failure you describe so others can reproduce it?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17762#comment:3>
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to