Malcolm, MT> That isn't an answer to the question Russell asked, though. You can get MT> exactly the same end-effect (using in-memory SQLite) if you specify MT> SQLite as the database engine in the settings file you use for testing. MT> Deriving your testing settings file from the main settings file is just MT> a matter of importing and replacing the right variable.
MT> The advantage of specifying SQLite directly (and the drawback to trying MT> to "fake it") is that Django won't inadvertently use any MySQL- or MT> PostgreSQL-specific SQL constructs under the covers when calling the MT> database. There are places we consider the value of MT> settings.DATABASE_ENGINE when constructing the SQL and we may leverage MT> that more in the future. MT> So what advantages are there to the mocking approach over just replacing MT> the setting? Ok, I'll be more wordy. I'm not using django's testing framework for several reasons: - I'm using django from 0.91 days and wasn't following django-users all this way - I use nose and twill for testing and they have no ready-to-use plugs into django testing (or I haven't been able to find it) Also simply overriding DATABASE_ENGINE to sqlite leads to problems. E.g. my code has profiles = models.User.objects.extra(where=[ "'%s'" % identity_url + "like concat(login, '%%')"]) But sqlite has no concat function and straightforward approach will lead to an exception. Thus sqlite_conn.connection.create_function('concat', 2, lambda *args: ''.join(args)) in DbMock setup. So, back to business.. My intention was to speedup unit tests and make initial test data setup easier. I am not proficient in django testing framework and couldn't utilize it with nosetests. DbMock solves my issue. Sure, I may be wrong and the proper way is to write nose test runner and file patches that provide more mysql or postgresql compatability for testing. -- Andrey V Khavryuchenko Django NewGate - http://www.kds.com.ua/djiggit/ Development - http://www.kds.com.ua Call akhavr1975 on www.gizmoproject.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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-users?hl=en -~----------~----~----~----~------~----~------~--~---