How do I run tests for all my Django apps only?

Viewed 4473

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?

4 Answers

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.

Related