Merge pull request #490 from mozilla/issue_488

Allow -t flag to specify text file with test names
This commit is contained in:
mwobensmith 2019-07-18 11:32:07 -07:00 коммит произвёл GitHub
Родитель 6e3af3ec8c 23aaca5b0b
Коммит 9494ec2122
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 18 добавлений и 13 удалений

Просмотреть файл

@ -36,19 +36,24 @@ def collect_tests():
if load_target(target):
include = core_args.test
exclude = core_args.exclude
tests_dir = os.path.join(PathManager.get_tests_dir(), target)
logger.debug('Path %s found. Checking content ...', tests_dir)
for dir_path, sub_dirs, all_files in PathManager.sorted_walk(tests_dir):
for current_file in all_files:
current_full_path = os.path.join(dir_path, current_file)
if current_file.endswith('.py') and not current_file.startswith('__') and include in current_full_path:
if exclude == '' or exclude not in current_full_path:
test_list.append(current_full_path)
if len(test_list) == 0:
logger.error('\'%s\' does not contain tests based on your search criteria. Exiting program.' % tests_dir)
if os.path.isfile(core_args.test):
with open(core_args.test, 'r') as f:
for line in f:
test_list.append(line.rstrip('\n'))
f.close()
else:
logger.debug('List of all tests found: [%s]' % ', '.join(map(str, test_list)))
tests_dir = os.path.join(PathManager.get_tests_dir(), target)
logger.debug('Path %s found. Checking content ...', tests_dir)
for dir_path, sub_dirs, all_files in PathManager.sorted_walk(tests_dir):
for current_file in all_files:
current_full_path = os.path.join(dir_path, current_file)
if current_file.endswith('.py') and not current_file.startswith('__') and include in current_full_path:
if exclude == '' or exclude not in current_full_path:
test_list.append(current_full_path)
if len(test_list) == 0:
logger.error('\'%s\' does not contain tests based on your search criteria. Exiting program.' % tests_dir)
else:
logger.debug('List of all tests found: [%s]' % ', '.join(map(str, test_list)))
return test_list