Permalink
Browse files

Switch to django-nose

  • Loading branch information...
1 parent f6e65fc commit 59fce78fd51e57c51221cd175d51f6a2e4779f99 @dcramer dcramer committed Jul 30, 2012
Showing with 24 additions and 8 deletions.
  1. +20 −8 runtests.py
  2. +4 −0 setup.py
View
@@ -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(
@@ -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__)
View
@@ -11,6 +11,10 @@
install_requires=[
'django',
],
+ tests_require=[
+ 'psycopg2',
+ 'django-nose',
+ ],
packages=find_packages(),
test_suite='runtests.runtests',
include_package_data=True,

0 comments on commit 59fce78

Please sign in to comment.