|
0
|
1 |
from django.core.management.base import BaseCommand |
|
|
2 |
from optparse import make_option |
|
|
3 |
import sys |
|
|
4 |
|
|
|
5 |
class Command(BaseCommand): |
|
|
6 |
option_list = BaseCommand.option_list + ( |
|
|
7 |
make_option('--noinput', action='store_false', dest='interactive', default=True, |
|
|
8 |
help='Tells Django to NOT prompt the user for input of any kind.'), |
|
|
9 |
) |
|
|
10 |
help = 'Runs the test suite for the specified applications, or the entire site if no apps are specified.' |
|
|
11 |
args = '[appname ...]' |
|
|
12 |
|
|
|
13 |
requires_model_validation = False |
|
|
14 |
|
|
|
15 |
def handle(self, *test_labels, **options): |
|
|
16 |
from django.conf import settings |
|
|
17 |
from django.test.utils import get_runner |
|
|
18 |
|
|
|
19 |
verbosity = int(options.get('verbosity', 1)) |
|
|
20 |
interactive = options.get('interactive', True) |
|
|
21 |
test_runner = get_runner(settings) |
|
|
22 |
|
|
|
23 |
failures = test_runner(test_labels, verbosity=verbosity, interactive=interactive) |
|
|
24 |
if failures: |
|
|
25 |
sys.exit(failures) |