Created
April 12, 2013 09:54
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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