Created
September 30, 2009 04:45
-
-
Save jbalogh/197797 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from optparse import make_option | |
import sys | |
from django.conf import settings | |
from django.core.management.base import BaseCommand | |
from django.test.utils import get_runner | |
test_runner = get_runner(settings) | |
if hasattr(test_runner, 'options'): | |
extra_options = test_runner.options | |
else: | |
extra_options = [] | |
class Command(BaseCommand): | |
option_list = BaseCommand.option_list + ( | |
make_option('--noinput', action='store_false', dest='interactive', default=True, | |
help='Tells Django to NOT prompt the user for input of any kind.'), | |
) + tuple(extra_options) | |
help = 'Runs the test suite for the specified applications, or the entire site if no apps are specified.' | |
args = '[appname ...]' | |
requires_model_validation = False | |
def handle(self, *test_labels, **options): | |
verbosity = int(options.get('verbosity', 1)) | |
interactive = options.get('interactive', True) | |
failures = test_runner(test_labels, verbosity=verbosity, interactive=interactive) | |
if failures: | |
sys.exit(failures) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment