diff options
Diffstat (limited to 'tests/runtests.py')
-rwxr-xr-x | tests/runtests.py | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/tests/runtests.py b/tests/runtests.py index 77bc1481d1..e733569212 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -27,6 +27,7 @@ ALWAYS_INSTALLED_APPS = [ 'django.contrib.messages', 'django.contrib.comments', 'django.contrib.admin', + 'django.contrib.admindocs', ] def get_test_models(): @@ -119,22 +120,19 @@ def django_tests(verbosity, interactive, failfast, test_labels): from django.db.models.loading import load_app # Load all the test model apps. + test_labels_set = set([label.split('.')[0] for label in test_labels]) for model_dir, model_name in get_test_models(): model_label = '.'.join([model_dir, model_name]) - try: - # if the model was named on the command line, or - # no models were named (i.e., run all), import - # this model and add it to the list to test. - if not test_labels or model_name in set([label.split('.')[0] for label in test_labels]): - if verbosity >= 1: - print "Importing model %s" % model_name - mod = load_app(model_label) - if mod: - if model_label not in settings.INSTALLED_APPS: - settings.INSTALLED_APPS.append(model_label) - except Exception, e: - sys.stderr.write("Error while importing %s:" % model_name + ''.join(traceback.format_exception(*sys.exc_info())[1:])) - continue + # if the model was named on the command line, or + # no models were named (i.e., run all), import + # this model and add it to the list to test. + if not test_labels or model_name in test_labels_set: + if verbosity >= 2: + print "Importing model %s" % model_name + mod = load_app(model_label) + if mod: + if model_label not in settings.INSTALLED_APPS: + settings.INSTALLED_APPS.append(model_label) # Add tests for invalid models. extra_tests = [] @@ -185,8 +183,8 @@ if __name__ == "__main__": from optparse import OptionParser usage = "%prog [options] [model model model ...]" parser = OptionParser(usage=usage) - parser.add_option('-v','--verbosity', action='store', dest='verbosity', default='0', - type='choice', choices=['0', '1', '2'], + parser.add_option('-v','--verbosity', action='store', dest='verbosity', default='1', + type='choice', choices=['0', '1', '2', '3'], help='Verbosity level; 0=minimal output, 1=normal output, 2=all output') parser.add_option('--noinput', action='store_false', dest='interactive', default=True, help='Tells Django to NOT prompt the user for input of any kind.') |