tags:

views:

46

answers:

1

Right now, if I want to run tests from all my apps, I go:

python manage.py test app1 app2 app3

If I run:

python manage.py test

The test of all apps in INSTALLED_APPS are run, including the django ones. Is there a simple command to run the tests of all the apps that I have created?

+2  A: 

Sadly there is no such command. Django has no way of telling which apps are "yours" versus which are someone else's.

What I would suggest is writing a new management command, call it mytest. Then create a new setting MY_INSTALLED_APPS. The mytest command will just run the test for every app in MY_INSTALLED_APPS. You'll want the mytest command to subclass django.core.management.base.AppCommand. django.core.management.call_command will also be helpful.

The only problem with this method is that you will have to constantly maintain the MY_INSTALLED_APPS setting to make sure it is correct.

Apreche
this solution can be made DRY by combining MY_INSTALLED_APPS with INSTALLED_APPS in `settings.py`. Then it's only a matter of deciding if you want the app to be run with `mytest` or not when you add it to the settings.
Brandon H
Brandon, good idea. Thanks!
Apreche