mirror of https://github.com/django/django.git
Adjusted runtests to the new layout.
This commit is contained in:
parent
89f40e3624
commit
fc074db29c
|
@ -10,15 +10,11 @@ from django.utils._os import upath
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
|
|
||||||
CONTRIB_DIR_NAME = 'django.contrib'
|
CONTRIB_DIR_NAME = 'django.contrib'
|
||||||
MODEL_TESTS_DIR_NAME = 'modeltests'
|
|
||||||
REGRESSION_TESTS_DIR_NAME = 'regressiontests'
|
|
||||||
|
|
||||||
TEST_TEMPLATE_DIR = 'templates'
|
TEST_TEMPLATE_DIR = 'templates'
|
||||||
|
|
||||||
RUNTESTS_DIR = os.path.dirname(upath(__file__))
|
RUNTESTS_DIR = os.path.dirname(upath(__file__))
|
||||||
CONTRIB_DIR = os.path.dirname(upath(contrib.__file__))
|
CONTRIB_DIR = os.path.dirname(upath(contrib.__file__))
|
||||||
MODEL_TEST_DIR = os.path.join(RUNTESTS_DIR, MODEL_TESTS_DIR_NAME)
|
|
||||||
REGRESSION_TEST_DIR = os.path.join(RUNTESTS_DIR, REGRESSION_TESTS_DIR_NAME)
|
|
||||||
TEMP_DIR = tempfile.mkdtemp(prefix='django_')
|
TEMP_DIR = tempfile.mkdtemp(prefix='django_')
|
||||||
os.environ['DJANGO_TEST_TEMP_DIR'] = TEMP_DIR
|
os.environ['DJANGO_TEST_TEMP_DIR'] = TEMP_DIR
|
||||||
|
|
||||||
|
@ -37,9 +33,9 @@ ALWAYS_INSTALLED_APPS = [
|
||||||
'django.contrib.admindocs',
|
'django.contrib.admindocs',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'django.contrib.humanize',
|
'django.contrib.humanize',
|
||||||
'regressiontests.staticfiles_tests',
|
'staticfiles_tests',
|
||||||
'regressiontests.staticfiles_tests.apps.test',
|
'staticfiles_tests.apps.test',
|
||||||
'regressiontests.staticfiles_tests.apps.no_label',
|
'staticfiles_tests.apps.no_label',
|
||||||
]
|
]
|
||||||
|
|
||||||
def geodjango(settings):
|
def geodjango(settings):
|
||||||
|
@ -51,12 +47,10 @@ def geodjango(settings):
|
||||||
def get_test_modules():
|
def get_test_modules():
|
||||||
modules = []
|
modules = []
|
||||||
for loc, dirpath in (
|
for loc, dirpath in (
|
||||||
(MODEL_TESTS_DIR_NAME, MODEL_TEST_DIR),
|
(None, RUNTESTS_DIR),
|
||||||
(REGRESSION_TESTS_DIR_NAME, REGRESSION_TEST_DIR),
|
|
||||||
(CONTRIB_DIR_NAME, CONTRIB_DIR)):
|
(CONTRIB_DIR_NAME, CONTRIB_DIR)):
|
||||||
for f in os.listdir(dirpath):
|
for f in os.listdir(dirpath):
|
||||||
if (f.startswith('__init__') or
|
if ('.' in f or
|
||||||
f.startswith('.') or
|
|
||||||
# Python 3 byte code dirs (PEP 3147)
|
# Python 3 byte code dirs (PEP 3147)
|
||||||
f == '__pycache__' or
|
f == '__pycache__' or
|
||||||
f.startswith('sql') or
|
f.startswith('sql') or
|
||||||
|
@ -118,7 +112,10 @@ def setup(verbosity, test_labels):
|
||||||
settings.INSTALLED_APPS.extend(['django.contrib.gis', 'django.contrib.sitemaps'])
|
settings.INSTALLED_APPS.extend(['django.contrib.gis', 'django.contrib.sitemaps'])
|
||||||
|
|
||||||
for module_dir, module_name in test_modules:
|
for module_dir, module_name in test_modules:
|
||||||
module_label = '.'.join([module_dir, module_name])
|
if module_dir:
|
||||||
|
module_label = '.'.join([module_dir, module_name])
|
||||||
|
else:
|
||||||
|
module_label = module_name
|
||||||
# if the module was named on the command line, or
|
# if the module was named on the command line, or
|
||||||
# no modules were named (i.e., run all), import
|
# no modules were named (i.e., run all), import
|
||||||
# this module and add it to the list to test.
|
# this module and add it to the list to test.
|
||||||
|
|
Loading…
Reference in New Issue