Changed model test framework to use meta.get_app() instead of a manual import
git-svn-id: http://code.djangoproject.com/svn/django/trunk@342 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
f6e75ab3cf
commit
a47794c824
|
@ -46,7 +46,7 @@ class TestRunner:
|
||||||
def run_tests(self):
|
def run_tests(self):
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.db import db
|
from django.core.db import db
|
||||||
from django.core import management
|
from django.core import management, meta
|
||||||
|
|
||||||
# Manually set INSTALLED_APPS to point to the test app.
|
# Manually set INSTALLED_APPS to point to the test app.
|
||||||
settings.INSTALLED_APPS = (APP_NAME,)
|
settings.INSTALLED_APPS = (APP_NAME,)
|
||||||
|
@ -89,7 +89,7 @@ class TestRunner:
|
||||||
for model_name in test_models:
|
for model_name in test_models:
|
||||||
self.output(1, "%s model: Importing" % model_name)
|
self.output(1, "%s model: Importing" % model_name)
|
||||||
try:
|
try:
|
||||||
mod = __import__(APP_NAME + '.models.' + model_name, '', '', [''])
|
mod = meta.get_app(model_name)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
log_error(model_name, "Error while importing", ''.join(traceback.format_exception(*sys.exc_info())[1:]))
|
log_error(model_name, "Error while importing", ''.join(traceback.format_exception(*sys.exc_info())[1:]))
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue