Skip to content

Commit

Permalink
Switch to django-nose
Browse files Browse the repository at this point in the history
  • Loading branch information
dcramer committed Jul 30, 2012
1 parent f6e65fc commit 59fce78
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
28 changes: 20 additions & 8 deletions runtests.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/usr/bin/env python
import sys
from os.path import dirname, abspath

from django.conf import settings
from optparse import OptionParser

if not settings.configured:
settings.configure(
Expand All @@ -23,15 +22,28 @@
DEBUG=False,
)

from django.test.simple import run_tests
from django_nose import NoseTestSuiteRunner


def runtests(*test_args, **kwargs):
if 'south' in settings.INSTALLED_APPS:
from south.management.commands import patch_for_test_db_setup
patch_for_test_db_setup()

def runtests(*test_args):
if not test_args:
test_args = ['uuidfield']
parent = dirname(abspath(__file__))
sys.path.insert(0, parent)
failures = run_tests(test_args, verbosity=1, interactive='--no-input' not in sys.argv)

kwargs.setdefault('interactive', False)

test_runner = NoseTestSuiteRunner(**kwargs)

failures = test_runner.run_tests(test_args)
sys.exit(failures)

if __name__ == '__main__':
runtests()
parser = OptionParser()
parser.add_option('--verbosity', dest='verbosity', action='store', default=1, type=int)
parser.add_options(NoseTestSuiteRunner.options)
(options, args) = parser.parse_args()

runtests(*args, **options.__dict__)
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
install_requires=[
'django',
],
tests_require=[
'psycopg2',
'django-nose',
],
packages=find_packages(),
test_suite='runtests.runtests',
include_package_data=True,
Expand Down

0 comments on commit 59fce78

Please sign in to comment.