Adrian Holovaty wrote: > On 6/28/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Is it appropriate to have a test that requires sqlite, or should tests > > always use the database engine(s) specified in settings? > > Tests should always use the database engines in settings.
Ok. > > If they should always use the engines in settings, when needing > > multiple databases, is it appropriate to kill the test with an error > > specifying how the settings must be set up for the test to run when the > > needed databases are not defined? Or should the test create the > > databases it needs using the default engine? > > It should work the way it works currently: It should attempt to create > a test database (or databases). If any database of that name already > exists, it should display a confirmation message. (Does this answer > your question?) Almost. I'll try to ask more clearly. The question is: say I have a test that requires connections in settings.DATABASES named 'a' and 'b'. If there are no such DATABASES keys, should the test just stop with an error saying: "This test requires connections in settings.DATABASES named 'a' and 'b'", or should it create test databases for the keys it needs, using the default settings as the template? Or is there a better way to handle this that I haven't thought of? (If the keys do exist, I assume that creating test databases and attaching to those names is the right thing to do, and that will be done in runtests.py.) Also, for sqlite, as far as I know there's no way to create multiple in-memory databases at the same time; is it ok to use temp files for this, or should the tests just not run with sqlite? > > Are there any objections to my adding setup/teardown support for model > > tests? (Basically: run module.setup() if defined before running tests; > > run module.teardown() if defined after running tests.) > > Yeah, I'm a bit hesitant to do this -- only because the model tests > double as our "model examples" documentation, and for that use it's > essential that the examples be clear. I should have looked at the doc generator before asking that, sorry -- I didn't understand how it worked. How about, instead, updating runtests so that it resets settings between tests? The reason this is needed is that the multiple db test needs to test and document how to create DATABASES settings, and I don't want to leave side-effects sitting around after the test. Thanks, JP --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers -~----------~----~----~----~------~----~------~--~---
