On 7/12/06, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > I've got a project at work that requires a formal test harness, so I > thought I would kill two birds with one stone and spend some time adding a > formal test framework for all Django applications. > > This came up a few weeks ago [1], and although I didn't comment at the time, > it struck me as a good idea. Plus, as Simon pointed out, it is a feature > that Rails has but Django does not, and we can't let those dirty Rails-using > savages have something that we don't :-) I have created ticket #2333 to > track the feature. >
Great, I think there're many people in need of a proper unit testing framework! > In my sandbox, I have made modifications such that: > - Any classes in models.py that extend unittest.TestCase will be identified > as a test case. > - Any doctests in models.py will be extracted as test cases (using normal > doctest extraction strategies - any module, class, or method level doctests, > plus anything listed in a __test__ attribute) > - If a mysite.myapp.tests module exists, it will be searched for unittests > and doctests in the same way as models.py I'd suggest using spesific test directories so that (for example) every directory would have a "test" subdirectory where all the test to that directory's objects etc. would reside. > When a test targets is executed, django-admin: > 1) creates a test database named 'test_' + settings.DATABASE_NAME This is created to the database server being used? Have you thought of spawning a new sqlite database to the memory and using that. That way you could be sure that no extra data is left behind (when you terminate the application, the sqlite goes down too). This would also enable testing in enviroinments where there is only one postgres db available for some reason. -- Jyrki // [EMAIL PROTECTED] --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
