Trusted test skipping about gis tests running or not

With the new test discovery system, gis tests are discovered as
other tests. They should be properly skipped now when dependencies
are missing. So let's stop special casing their inclusion.
This commit is contained in:
Claude Paroz 2013-07-09 15:17:26 +02:00
parent 74bc63b109
commit bd563f0f57
2 changed files with 6 additions and 39 deletions

View file

@ -12,16 +12,19 @@ from django.utils._os import upath
from django.utils import six
CONTRIB_MODULE_PATH = 'django.contrib'
CONTRIB_GIS_TESTS_PATH = 'django.contrib.gis.tests'
TEST_TEMPLATE_DIR = 'templates'
RUNTESTS_DIR = os.path.abspath(os.path.dirname(upath(__file__)))
CONTRIB_DIR = os.path.dirname(upath(contrib.__file__))
CONTRIB_GIS_TESTS_DIR = os.path.join(CONTRIB_DIR, 'gis', 'tests')
TEMP_DIR = tempfile.mkdtemp(prefix='django_')
os.environ['DJANGO_TEST_TEMP_DIR'] = TEMP_DIR
SUBDIRS_TO_SKIP = [
'data',
'templates',
'test_discovery_sample',
'test_discovery_sample2',
@ -52,7 +55,8 @@ def get_test_modules():
modules = []
for modpath, dirpath in (
(None, RUNTESTS_DIR),
(CONTRIB_MODULE_PATH, CONTRIB_DIR)):
(CONTRIB_MODULE_PATH, CONTRIB_DIR),
(CONTRIB_GIS_TESTS_PATH, CONTRIB_GIS_TESTS_DIR)):
for f in os.listdir(dirpath):
if ('.' in f or
# Python 3 byte code dirs (PEP 3147)
@ -64,6 +68,7 @@ def get_test_modules():
modules.append((modpath, f))
return modules
def get_installed():
from django.db.models.loading import get_apps
return [app.__name__.rsplit('.', 1)[0] for app in get_apps()]
@ -125,14 +130,6 @@ def setup(verbosity, test_labels):
bits = bits[:1]
test_labels_set.add('.'.join(bits))
# If GeoDjango, then we'll want to add in the test applications
# that are a part of its test suite.
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
if HAS_SPATIAL_DB:
from django.contrib.gis.tests import geo_apps
test_modules.extend(geo_apps())
settings.INSTALLED_APPS.extend(['django.contrib.gis', 'django.contrib.sitemaps'])
for modpath, module_name in test_modules:
if modpath:
module_label = '.'.join([modpath, module_name])