On Wed, Dec 9, 2009 at 8:53 AM, Martin Omander <[email protected]> wrote: > Hi all, > > How about letting Django users run unit tests without creating a new > test database? > > To use Django's built-in unit test harness, you have to have database > creation privileges. Not all web hosts give users those privileges. > For example, Webfaction, an excellent commercial Django host by all > accounts (http://djangohosting.org), doesn't. This means there are > Django users out there who can't run unit tests. > > See here for an example http://forum.webfaction.com/viewtopic.php?pid=13266 > > The third message in that thread is from me, outlining how I solved > the problem by hacking the Django testing code. > > Would it be worth it to add an option in the testing code that would > allow users to run unit tests without database creation privileges? > Any thoughts on what it would look like?
It already is available as an option - albeit perhaps not an obvious one. Django allows you to define a custom test runner. Copy django.tests.simple.run_tests() into your own code, removing the calls to create and destroy the test database. Then set TEST_RUNNER in your settings file to point at the new runner. Yours Russ Magee %-) -- 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?hl=en.
