checker: display results at the end

This commit is contained in:
Alexandre Flament 2024-03-01 09:30:43 +01:00 committed by Alexandre Flament
parent 08e7c37a35
commit 1a66bfa66c

View File

@ -55,7 +55,7 @@ def iter_processor(engine_name_list):
if processor is not None:
yield name, processor
else:
stdout.write(f'{BOLD_SEQ}Engine {name:30}{RESET_SEQ}{RED}Engine does not exist{RESET_SEQ}')
stdout.write(f'{BOLD_SEQ}Engine {name:30}{RESET_SEQ}{RED}Engine does not exist{RESET_SEQ}\n')
else:
for name, processor in searx.search.PROCESSORS.items():
yield name, processor
@ -64,12 +64,17 @@ def iter_processor(engine_name_list):
# actual check & display
def run(engine_name_list, verbose):
searx.search.initialize()
name_checker_list = []
for name, processor in iter_processor(engine_name_list):
stdout.write(f'{BOLD_SEQ}Engine {name:30}{RESET_SEQ}Checking\n')
if not sys.stdout.isatty():
stderr.write(f'{BOLD_SEQ}Engine {name:30}{RESET_SEQ}Checking\n')
checker = searx.search.checker.Checker(processor)
checker.run()
name_checker_list.append((name, checker))
stdout.write(f'\n== {BOLD_SEQ}Results{RESET_SEQ} ' + '=' * 70 + '\n')
for name, checker in name_checker_list:
if checker.test_results.successful:
stdout.write(f'{BOLD_SEQ}Engine {name:30}{RESET_SEQ}{GREEN}OK{RESET_SEQ}\n')
if verbose: