Code

Ticket #12574: runtests.diff

File runtests.diff, 1.7 KB (added by CarlFK, 5 years ago)
Line 
1Index: tests/runtests.py
2===================================================================
3--- tests/runtests.py   (revision 12203)
4+++ tests/runtests.py   (working copy)
5@@ -125,20 +125,16 @@
6     # Load all the test model apps.
7     for model_dir, model_name in get_test_models():
8         model_label = '.'.join([model_dir, model_name])
9-        try:
10-            # if the model was named on the command line, or
11-            # no models were named (i.e., run all), import
12-            # this model and add it to the list to test.
13-            if not test_labels or model_name in set([label.split('.')[0] for label in test_labels]):
14-                if verbosity >= 1:
15-                    print "Importing model %s" % model_name
16-                mod = load_app(model_label)
17-                if mod:
18-                    if model_label not in settings.INSTALLED_APPS:
19-                        settings.INSTALLED_APPS.append(model_label)
20-        except Exception, e:
21-            sys.stderr.write("Error while importing %s:" % model_name + ''.join(traceback.format_exception(*sys.exc_info())[1:]))
22-            continue
23+        # if the model was named on the command line, or
24+        # no models were named (i.e., run all), import
25+        # this model and add it to the list to test.
26+        if not test_labels or model_name in set([label.split('.')[0] for label in test_labels]):
27+            if verbosity >= 1:
28+                print "Importing model %s" % model_name
29+            mod = load_app(model_label)
30+            if mod:
31+                if model_label not in settings.INSTALLED_APPS:
32+                    settings.INSTALLED_APPS.append(model_label)
33 
34     # Add tests for invalid models.
35     extra_tests = []