Fixed error when trying to import the GEOS tests from their new location.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10137 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Justin Bronn 2009-03-24 04:26:56 +00:00
parent fd46f673bd
commit 91ebe9acae
1 changed files with 7 additions and 12 deletions

View File

@ -204,21 +204,16 @@ def run_tests(test_labels, verbosity=1, interactive=True, extra_tests=[], suite=
# Class for creating a fake module with a run method. This is for the # Class for creating a fake module with a run method. This is for the
# GEOS and GDAL tests that were moved to their respective modules. # GEOS and GDAL tests that were moved to their respective modules.
class _DeprecatedTestModule(object): class _DeprecatedTestModule(object):
def __init__(self, tests, mod): def __init__(self, mod_name):
self.tests = tests self.mod_name = mod_name
self.mod = mod
def run(self): def run(self):
from warnings import warn from warnings import warn
warn('This test module is deprecated because it has moved to ' \ warn('This test module is deprecated because it has moved to ' \
'`django.contrib.gis.%s.tests` and will disappear in 1.2.' % '`django.contrib.gis.%s.tests` and will disappear in 1.2.' %
self.mod, DeprecationWarning) self.mod_name, DeprecationWarning)
self.tests.run() tests = import_module('django.contrib.gis.%s.tests' % self.mod_name)
tests.run()
from django.contrib.gis.geos import tests as _tests test_geos = _DeprecatedTestModule('geos')
test_geos = _DeprecatedTestModule(_tests, 'geos') test_gdal = _DeprecatedTestModule('gdal')
from django.contrib.gis.gdal import HAS_GDAL
if HAS_GDAL:
from django.contrib.gis.gdal import tests as _tests
test_gdal = _DeprecatedTestModule(_tests, 'gdal')