Matthew Flanagan wrote:
On 04/09/06, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:
  
On 9/4/06, Ned Batchelder <[EMAIL PROTECTED]> wrote:
    
Partly on this topic:  I would very much like to use sqlite in-memory
      
databases for testing, even though I use MySQL for deployment.  The speed
difference is 10x.  One way to do this is to have a TEST_DATABASE_ENGINE
setting, and add logic to create_test_db().
    
Thoughts?

      
If there were a TEST_DATABASE_ENGINE setting, it would imply that there were
analogs of all the other DATABASE_ settings, too. I can't say I'm crazy
about this idea. 'Deploy under MySQL, but test under PostgreSQL' isn't a
particularly compelling use case for me. IMHO, testing for one database but
deploying onto another sort of defeats the purpose of testing.

However, when you are developing unit tests, having a fast turnaround on
test execution is certainly desirable; using SQLite in-memory is certainly
one way to get this fast turnaround.

Rather than having TEST_DATABASE_ENGINE (which implies that ANY database
engine could be used), I would be inclined to have a TEST_IN_MEMORY setting,
which forces all tests to be run in SQLite, using an in memory database.

Furthermore, I would be inclined to make this a command line option, rather
than a permanent setting. IMHO, tests should always be executed against the
_actual_ database that will be used during deployment. Although there
_shouldn't_ be any differences between databases, there occasionally will be
- either due to kinks in Django, or because you are deploying custom SQL.
Providing a command line option would provide a workaround to get fast
development turnarounds without compromising the default (read - preferable)
testing conditions.

Opinions?

Yours,
Russ Magee %-)


    

I don't see the need for Django specific TEST_* settings when it is
simple enough to do this in myapp/testsettings.py:

from myapp.settings import *
DATABASE_ENGINE='sqlite3'
DATABASE_NAME=':memory:'

and use ./manage.py --settings=myapp.testsettings.


matthew
  
An excellent suggestion!
-- 
Ned Batchelder, http://nedbatchelder.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to