add: python tester

This commit is contained in:
2025-12-17 04:06:01 -06:00
parent d977022554
commit fd69df92f2
9 changed files with 129 additions and 3 deletions

24
test/parsing.py Normal file
View File

@@ -0,0 +1,24 @@
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}"))