Skip to content

Instantly share code, notes, and snippets.

@jimr
jimr / gist:5370940
Created April 12, 2013 09:54
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
@eculver
eculver / Python SMTP server one-liner
Created October 27, 2009 16:54
Python SMTP server one-liner
python -m smtpd -n -c DebuggingServer localhost:1025