Skip to content
Browse files

saner test runner

  • Loading branch information...
1 parent 6ee06fa commit d3eb89dfa10efd3c991bb1ab530119c5451653a0 @HonzaKral committed Jan 1, 2012
Showing with 13 additions and 9 deletions.
  1. +13 −9 tests/run_tests.py
View
22 tests/run_tests.py
@@ -9,26 +9,30 @@ def usage():
print 'run_tests.py APP [node args]'
sys.exit(1)
-def run_test(app, argv=None):
- for p in ('--with-coverage', '--cover-package=haystack', '--cover-erase'):
- if p not in argv:
- argv.append(p)
+def run_test(app, argv):
appdir = app
- settings = 'settings'
if not path.isdir(appdir):
appdir += '_tests'
- argv.append(appdir)
-
+ settings = 'settings'
if path.exists('%s_settings.py' % app):
settings = '%s_settings' % app
- environ['DJANGO_SETTINGS_MODULE'] = settings
-
if not path.isdir(appdir) or not path.exists(settings + '.py'):
usage()
+ environ['DJANGO_SETTINGS_MODULE'] = settings
+
+ # only tell nose to run the app tests if the user hasn't specified a test to run
+ if len(argv) == 1 or not any(not a.startswith('-') for a in argv[1:]):
+ argv.append(appdir)
+
+ for p in ('--with-coverage', '--cover-package=haystack', '--cover-erase'):
+ if p not in argv:
+ argv.append(p)
+
+
nose.run_exit(
argv=argv,
defaultTest=path.abspath(path.dirname(__file__))

0 comments on commit d3eb89d

Please sign in to comment.
Something went wrong with that request. Please try again.