return proper error rc

This commit is contained in:
Maxim Kurnikov
2019-01-26 17:59:12 +03:00
parent db3f958d2c
commit 145ce6bf18

View File

@@ -17,17 +17,15 @@ IGNORED_ERROR_PATTERNS = [
'Invalid value for a to= parameter' 'Invalid value for a to= parameter'
] ]
TESTS_DIRS = [ TESTS_DIRS = [
'absolute_url_overrides', # 'absolute_url_overrides',
'admin_*', 'admin_custom_urls',
'aggregation', #'aggregation_regress',
'aggregation_regress', #'annotations',
'annotations', #'app_loading',
'app_loading',
'apps',
'auth_tests'
] ]
def check_file_in_the_current_directory(directory, fname): def check_file_in_the_current_directory(directory, fname):
rc = 0
cd @(directory) cd @(directory)
with ${...}.swap(FNAME=fname): with ${...}.swap(FNAME=fname):
for line in $(mypy --config-file ../../../scripts/mypy.ini $FNAME).split('\n'): for line in $(mypy --config-file ../../../scripts/mypy.ini $FNAME).split('\n'):
@@ -36,8 +34,10 @@ def check_file_in_the_current_directory(directory, fname):
break break
else: else:
if line: if line:
print(line, file=sys.stderr) rc = 1
print(line)
cd - cd -
return rc
def parse_ls_output_into_fnames(output): def parse_ls_output_into_fnames(output):
fnames = [] fnames = []
@@ -51,6 +51,7 @@ for test_dir in TESTS_DIRS:
dirs = g`django-sources/tests/$TEST_DIR` dirs = g`django-sources/tests/$TEST_DIR`
all_tests_dirs.extend(dirs) all_tests_dirs.extend(dirs)
rc = 0
for tests_dir in all_tests_dirs: for tests_dir in all_tests_dirs:
print('Checking ' + tests_dir) print('Checking ' + tests_dir)
abs_dir = os.path.join(os.getcwd(), tests_dir) abs_dir = os.path.join(os.getcwd(), tests_dir)
@@ -59,5 +60,8 @@ for tests_dir in all_tests_dirs:
ls_output = $(ls -lhv --color=auto -F --group-directories-first $ABS_DIR) ls_output = $(ls -lhv --color=auto -F --group-directories-first $ABS_DIR)
for fname in parse_ls_output_into_fnames(ls_output): for fname in parse_ls_output_into_fnames(ls_output):
path_to_check = os.path.join(abs_dir, fname) path_to_check = os.path.join(abs_dir, fname)
check_file_in_the_current_directory(abs_dir, fname) current_step_rc = check_file_in_the_current_directory(abs_dir, fname)
if current_step_rc != 0:
rc = current_step_rc
sys.exit(rc)