How to launch tests for django reusable app?

Viewed 7958

Can I launch tests for my reusable Django app without incorporating this app into a project?

My app uses some models, so it is necessary to provide (TEST_)DATABASE_* settings. Where should I store them and how should I launch tests?

For a Django project, I can run tests with manage.py test; when I use django-admin.py test with my standalone app, I get:

Error: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.

What are the best practises here?

6 Answers

I know this is an old thread, but I have found that if your reusable app has a file 'tests.py', then you can create a tests.py inside your project folder, and then write the following...

from reusableapp.tests import *

Django will then run these tests when you call 'python manage.py test'

Related