Skip to content

Instantly share code, notes, and snippets.

@mstepniowski
Created January 29, 2013 20:51
Show Gist options
  • Save mstepniowski/4667736 to your computer and use it in GitHub Desktop.
Save mstepniowski/4667736 to your computer and use it in GitHub Desktop.
Run tests of a standalone Django package.
import sys
from django.conf import settings
settings.configure(
DEBUG=True,
DATABASES={'default': {'ENGINE': 'django.db.backends.sqlite3'},
'secondary': {'ENGINE': 'django.db.backends.sqlite3'}},
INSTALLED_APPS=['django.contrib.auth',
'django.contrib.contenttypes',
'sjcommon'])
from django.test.simple import DjangoTestSuiteRunner
test_runner = DjangoTestSuiteRunner(verbosity=1)
failures = test_runner.run_tests(['sjcommon'])
if failures:
sys.exit(failures)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment