123
124
# Load all the test model apps.
125
test_labels_set = set([label.split('.')[0] for label in test_labels])
124
126
for model_dir, model_name in get_test_models():
125
127
model_label = '.'.join([model_dir, model_name])
127
# if the model was named on the command line, or
128
# no models were named (i.e., run all), import
129
# this model and add it to the list to test.
130
if not test_labels or model_name in set([label.split('.')[0] for label in test_labels]):
132
print "Importing model %s" % model_name
133
mod = load_app(model_label)
135
if model_label not in settings.INSTALLED_APPS:
136
settings.INSTALLED_APPS.append(model_label)
138
sys.stderr.write("Error while importing %s:" % model_name + ''.join(traceback.format_exception(*sys.exc_info())[1:]))
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:
133
print "Importing model %s" % model_name
134
mod = load_app(model_label)
136
if model_label not in settings.INSTALLED_APPS:
137
settings.INSTALLED_APPS.append(model_label)
141
139
# Add tests for invalid models.