Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.2.X] Fixed #12574 -- Removed an unnecessary exception catch from t…

…he system runtest script, which could hide failing tests. Thanks to CarlFK for the report, and Ramiro Morales for the polish.

Backport of r13616 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@13617 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 1c3e3d3dba0a833981ed39da42e0bed015400d40 1 parent c3b13d8
Russell Keith-Magee authored August 20, 2010

Showing 1 changed file with 11 additions and 14 deletions. Show diff stats Hide diff stats

  1. 25  tests/runtests.py
25  tests/runtests.py
@@ -122,22 +122,19 @@ def django_tests(verbosity, interactive, failfast, test_labels):
122 122
     get_apps()
123 123
 
124 124
     # Load all the test model apps.
  125
+    test_labels_set = set([label.split('.')[0] for label in test_labels])
125 126
     for model_dir, model_name in get_test_models():
126 127
         model_label = '.'.join([model_dir, model_name])
127  
-        try:
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)
138  
-        except Exception, e:
139  
-            sys.stderr.write("Error while importing %s:" % model_name + ''.join(traceback.format_exception(*sys.exc_info())[1:]))
140  
-            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 test_labels_set:
  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)
141 138
 
142 139
     # Add tests for invalid models.
143 140
     extra_tests = []

0 notes on commit 1c3e3d3

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