Skip to content

Instantly share code, notes, and snippets.

@jimr
Created April 12, 2013 09:54
Show Gist options
  • Save jimr/5370940 to your computer and use it in GitHub Desktop.
Save jimr/5370940 to your computer and use it in GitHub Desktop.
Django test suite discovery that works with `python manage.py test` and `django-jenkins`. If you want to put your tests in a folder instead of `tests.py`, you need to define a `suite` in your `models.py` as below.
# put this in your_app/models.py
def suite():
"""Django test discovery."""
import nose
import unittest
path = os.path.join(os.path.dirname(__file__), 'tests')
suite = unittest.TestSuite()
suite.addTests(nose.loader.TestLoader().loadTestsFromDir(path))
return suite
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment