1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #28996 -- Simplified some boolean constructs and removed trivial continue statements.

This commit is contained in:
Дилян Палаузов
2018-01-12 09:05:16 -05:00
committed by Tim Graham
parent 4bcec02368
commit a38ae914d8
34 changed files with 95 additions and 159 deletions

View File

@@ -85,12 +85,11 @@ def get_test_modules():
for modpath, dirpath in discovery_paths:
for f in os.listdir(dirpath):
if ('.' in f or
os.path.basename(f) in SUBDIRS_TO_SKIP or
os.path.isfile(f) or
not os.path.exists(os.path.join(dirpath, f, '__init__.py'))):
continue
modules.append((modpath, f))
if ('.' not in f and
os.path.basename(f) not in SUBDIRS_TO_SKIP and
not os.path.isfile(f) and
os.path.exists(os.path.join(dirpath, f, '__init__.py'))):
modules.append((modpath, f))
return modules
@@ -189,13 +188,11 @@ def setup(verbosity, test_labels, parallel):
# if the module (or an ancestor) was named on the command line, or
# no modules were named (i.e., run all), import
# this module and add it to INSTALLED_APPS.
if not test_labels:
module_found_in_labels = True
else:
module_found_in_labels = any(
# exact match or ancestor match
module_label == label or module_label.startswith(label + '.')
for label in test_labels_set)
module_found_in_labels = not test_labels or any(
# exact match or ancestor match
module_label == label or module_label.startswith(label + '.')
for label in test_labels_set
)
if module_name in CONTRIB_TESTS_TO_APPS and module_found_in_labels:
settings.INSTALLED_APPS.append(CONTRIB_TESTS_TO_APPS[module_name])