Ticket #12574: runtests.diff

File runtests.diff, 1.7 KB (added by CarlFK, 14 years ago)
  • tests/runtests.py

     
    125125    # Load all the test model apps.
    126126    for model_dir, model_name in get_test_models():
    127127        model_label = '.'.join([model_dir, model_name])
    128         try:
    129             # if the model was named on the command line, or
    130             # no models were named (i.e., run all), import
    131             # this model and add it to the list to test.
    132             if not test_labels or model_name in set([label.split('.')[0] for label in test_labels]):
    133                 if verbosity >= 1:
    134                     print "Importing model %s" % model_name
    135                 mod = load_app(model_label)
    136                 if mod:
    137                     if model_label not in settings.INSTALLED_APPS:
    138                         settings.INSTALLED_APPS.append(model_label)
    139         except Exception, e:
    140             sys.stderr.write("Error while importing %s:" % model_name + ''.join(traceback.format_exception(*sys.exc_info())[1:]))
    141             continue
     128        # if the model was named on the command line, or
     129        # no models were named (i.e., run all), import
     130        # this model and add it to the list to test.
     131        if not test_labels or model_name in set([label.split('.')[0] for label in test_labels]):
     132            if verbosity >= 1:
     133                print "Importing model %s" % model_name
     134            mod = load_app(model_label)
     135            if mod:
     136                if model_label not in settings.INSTALLED_APPS:
     137                    settings.INSTALLED_APPS.append(model_label)
    142138
    143139    # Add tests for invalid models.
    144140    extra_tests = []
Back to Top