import subprocess import os import signal import time import thread_manager from print import print_test def _test(title: str, excutable: str, args: str, exit_code: int, log_path: str) -> None: if not os.path.exists(log_path): os.makedirs(log_path) f = open(f"{log_path}/{title}.log", "w") p = subprocess.Popen(f"{excutable} {args}".split(" "), stdout=f, stderr=f) time.sleep(0.05) p.send_signal(signal.SIGINT) value = p.wait() f.close() print_test(exit_code, value, title, args) def test_parsing(excutable: str, tests_category: dict[str, list[dict[str, str]]], log_path: str): for category_name, tests in tests_category.items(): print(category_name, end="\n" * 2) for test in tests: thread_manager.add_to_queu(_test, (test["title"], excutable, test['args'], test['exit'], f"{log_path}/{category_name}"))